Why does the deletion of *.dll.refresh file have no affect? - asp.net

The *.dll.refresh file tells visual studio about the class library location but whenever I delete it the application still works in debugging mode.
Why is this? Is the location not needed?

Because that's only a pointer to the referenced DLL.
It is used to copy the DLL to the bin location, but if you already copied the DLL, then deleting the .refresh file won't affect Visual Studio
If you delete the DLL from the bin folder and the _*.refresh_ file then you would get compilation errors if you try to access the types defined in the referenced DLL

dll.refresh files gives the path of the DLL in question to tell visual studio where to find it. They will be created each time you add a reference to the project.
They normally appear when you are using a project type that does not create a standard Visual Studio project file, as normally paths to referenced DLLs would go in there.
Their role ends once DLL gets loaded in your project. Hence you will not get any error
when you delete *.dll.refresh files from your project.

Related

Why are c++ .dll not recognized in bin folder of asp.net webapp?

I create an ASP.NET Webapp with Razor syntax in Visual Studio 2015, in C#.
I have to use 20 third party native c++ dll files (most of them for image handing, libtiff-5.dll, libpng16-16.dll, etc...).
Even when I manually copy those dll files into the bin folder, the app would not run. The error is:
Could not load file or assembly 'managedDllWrapper.DLL' or one of its dependencies. The specified module could not be found.
But according to almost all hints in the internet, copying to bin folder should work.
When I copy the dlls into the C:\Windows folder, the webapp runs perfectly, but only locally on my machine.
Also, when I create a C# Console app, instead of a webapp, copying into the bin folder works fine.
Why doesn't it work for a webapp? How can I import those dlls?
I cannot reference them into Visual Studio to the project, as they are not a valid COM assembly.
the dlls are not imported in the code with dllimport, as I don't know the specific functions they provide. A managed dll wrapper uses the dlls.
Any ideas? Thanks!
I did not solve the problem one to one, but I circumvented the problem successfully:
By rewriting the c#/c++ wrapper with explicit dllimport, I adressed the dll files directly with path. Then, the dependent dll just have to be in the same folder as the referenced dll. This works also in web apps.

Copy dlls that are not referenced in the project into published folder in Visual Studio 2012

I m generating resource assemblies from text files by executing a bat file in the pre-build event and copying them into bin folder. These resource assemblies are therefore not referenced in the project.
At present I need to manually copy these dlls into published folder.
Is there a clean way that ensures that everytime I publish, the required dlls are copied into published folder.
Note: I do not want to hard code physical path for deployment folder in the bat file/ or prebuild events.
Please select the DLL and open Property and Marked "Copy Local" as True. Please refer below image. it may help you.

Visual studio unable to detect Sitecore.Web namespace

Currently I'm playing with sitecore 7. I followed this blog to setup my visual studio with the sitecore.
Everything is fine until when I tried to create a sc:placeholder on the aspx.
It throws this error regardless whatever sitecore control I have tried to insert:
Error 180 The type or namespace name 'Web' does not exist in the namespace 'Sitecore' (are you missing an assembly reference?)
C:\inetpub\wwwroot\abc Sc7\Website\layouts\Customized\MainLayout.aspx.designer.cs
I tried to create a placeholder using code behind, no error was thrown.
I have tried to create an empty web application project. And added a reference to only Sitecore.Kernel.dll
I created a dummy page to test out the reference to the dll thing.
It still throws the same errors.
I know the blog mentions it, but have you added a reference to the "Sitecore.Kernel" DLL in your project? Open your references folder and ensure that there is not a problem with the reference.
Make sure your project is using .net 4.5 (you will need to use something other than VS2010)
After default sitecore installtion Sitecore.Kernel assembly is placed in bin folder. Maybe you used 'Clean project' and after this operation your assembly was deleted. Please check if this assembly is present in bin folder. It should be loaded by IIS automatically from bin folder, even if you have wrong reference in you csproj file.
When I start new project I always move dlls from bin folder to other folder, and put references to this files in csproj, so when I run clean project (or clean solution from VS) i have empty folder (only one file is present - *.lic file).

Unable to load DLL,wrong location?

I have made a website with Visual Studio 2010. I have a simple Fortran .dll that I want to call from my project. I have added this DLL in my project but when I run it I get the error:
Unable to load DLL 'Dll1.dll': The specified module could not be found.
which probably means that the DLL can not be found. Do I have to add the .dll somewhere specifically or add the location of the DLL to the code?
Assuming that Dll1.dll is the DLL that is one that's referenced, make sure that in Solution Explorer, this DLLs properties are set to Copy Always.
Right-click the dll file, click on properties, then in the properties pane below the solution explorer, set "Copy to Output Directory" to "Copy Always".

Attach DLL to ASP.NET Site

How do you attach a DLL to a asp.net site? I want to be able to debug and edit the DLL without having to keep replacing the reference in my asp.net site. I checked attach to process but didn't see the worker process. I am using asp.net, IIS 7.
Just put it into /bin folder of your web application.
OR
Add reference to this .dll by right clicking on References > Add Reference > Browse > Select your .dll file and lick OK.
Then set it's "Copy Local" property to "True". This way .dll will be copied into /Bin folder each time you build application.
alt text http://xmages.net/out.php/i170817_1.png
Using Visual Studio you should create a solution that has your website as a project and the DLL (code) as another project. Make a reference in the website project to the DLL project and it should update it automatically.
If you are not using the web application model and just the website model you could just have your DLL project output to your website's /bin directory directly. That will update the DLL in the website/bin folder whenever you build your DLL project.
If you want to edit the dll, open that project up in a second instance of Visual Studio and treat it like you would for any other project.
Set the reference in your /bin folder to the debug dll that the second Visual Studio creates.
I'm assuming you have Visual Studio...
If you're just trying to add a dll, you can add a reference to it by right clicking on your website node and choosing "Add Reference..." .
You will be able to debug the dll if you have its pdb along with it (to load the symbols from). You will NOT be able to edit the dll.
If the dll is in fact another project you have the source code for, just add the project to your solution, and from your website project add a reference from the "projects" tab. VS should add a reference and dependency so that it keeps the dll updated when you change code in your dll project.

Resources