We have some DLLs in the bin folder. We build the DLLs in separate solutions and output to different directories. Now, when I build the web site, the DLLs in its bin folder gets updated automatically with the latest version (from those dirs). Now I am wondering how does that work? I mean, how did the build know from where to pull the latest bits of my DLLs? That looks magic to me...
When the website is getting build, the dlls will be copied to the target directory from the referenced location. Please check if the CopyLocal is set to True or False for each reference.
When building the web site, you must be referencing the DLLs from the other folder.
Related
Backgroud:
I am in the process of migrating a console application to be part of our existing web API project. All development work is done on Visual Studiod 2015 (with IIS Express). The application uses few third party datasource api DLLs to grab data from that datasource. All these DLLs are managed by our internal nuget package sources.
Issue:
Now the console application runs fine and can load up the those DLLs. I copied across the logic into my web project and added the DLLs via nuget. Solution builds but got the following error when starting up the web project:
Could not load file or assembly 'ABC.DLL' or one of its dependencies. The specified module could not be found.
Where ABC.DLL is one of the third party DLLs.
I have done the following:
Confirm ABC.DLL is in the bin folder of my web project
Changed target build platform of my web project to be x86 and unchecked "Use 64 bit version of IIS Express for websites and project" setting in VS2015 (the third party dll is 32-bit)
Ran dumpbin.exe on ABC.DLL's dependency and got XYZ.dll,MSVCR120.dll,KERNEL32.dll,MSVCP120.dll,mscoree.dll
Regarding to the last step, those dlls were all missing in the bin folder (but the last 4 DLLs should be in system32 win directory so shouldn't matter?)
As for XYZ.dll, it is another third party library and is located on C:\Program Files (x86)\XYZ\ folder. I manually copied it across to the web project bin folder (in fact copied across all Dlls inside XYZ folder) and still get the same issue.
Questions
What am I missing here? The console app obviously can load ABC.DLL but the web project can't. Appreciate it if you can tell me what to check next.
The error message from start up web page is not very useful, is there a way to find out where the web project is trying to load the third party DLLs?
Thank you in advance!
Simply adding external DLLs to your Bin folder is not a great idea. Files can disappear from this folder for various reasons, such as your team members deleting a seemingly useless DLL, or through Visual Studio clearing it. Also, the output DLLs from referenced projects in your solution, would end up there, and are replaced every time you build your project.
What you should do for third-party DLLs, is create some "dependencies" folder in, or close to, your project, and stick the DLLs in there. Then you should right-click on the project, select Add Reference, browse to that new "dependencies" folder, and add a reference to the DLL that way. This is similar to the way NuGet works; it keeps DLLs in their respective folders inside the packages folder, and adds references to those DLLs.
I finally found the issue and thanks for all the help, I had to disable shadow copying in VS (mentioned in 64 bit managed assembly with unmanaged dependencies not loading in IIS / ASP.NET MVC 4).
I have a problem with Umbraco backoffice when my site is online.
I published my site with Visual Studio 2015 and it works fine, but when i try to open the Umbraco backoffice i get an error that says
Could not load file or assembly "Umbraco.ModelsBuilder" or one of its dependencies. The system cannot find the file specified
but, in the folder bin the dll exists. When i test the project in local it works perfectly.
Could anyone give me some advices?
Thanks
Try deleting all files and folders under /bin/* on your remote installation.
Then in Visual Studio Rebuild Solution and Publish again.
Additionally when anything in Umbraco doesn't work, always first delete the whole /TEMP folder under /App_Data and restart Umbraco.
It could be one of the other dependencies missing. Compare what's in your /bin/ folder locally with what's on the live site's /bin/ folder and see if there's any DLLs missing. If they're not the same, copy up the missing files and see if that sorts out the problem for you.
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.
What's a 'bin.net3.5' file that gets created in the same folder as the VS2012 solution that contains an ASP.net website?
I would like to mention that this is a file and I am not referring to the project's 'bin' directory where projects' compiled dlls will be placed after a build.
As discussed it seems that this is something related to your project specific file. There is no such standard file created by Visual Studio 2012
Bin Folder
ASP.NET recognizes the Bin folder of a website as a special folder for
specific types of content. A Bin folder is meant to contain compiled
assemblies (.dll files) for custom ASP.NET controls, components, or
other code that you want to reference in your ASP.NET web application.
You can store compiled assemblies in the Bin folder, and other code
anywhere in the web application (such as code for pages) automatically
references it. A typical example is that you have the compiled code
for a custom class. You can copy the compiled assembly to the Bin
folder of your Web application and the class is then available to all
pages.
Some DLL's are kept in different folder names to determine the version, you'll notice when using nuget, the dll's will go into a packages folder, and are often split as net40, net45 etc
When you build the project, your Dll's will go into the Bin directory.
I have a bunch of assemblies (DLLs) I want to reference in my current .NET 4.5 project. However, right now all of them sit in some local folder in my Hard Drive. When someone works on this same project, these reference assemblies obviously aren't in the same local folder. My plan is to copy these assemblies into some folder in my project, and put that in source control.
Is this a good plan? And what folder do these things usually go to?
NuGet is a prefer method; however, some assemblies are not in NuGet. So here is an example what nopCommerce does.
Create a Dependencies folder (inside your project folder)
Keeps all third parties assemblies inside it.
Definitely a good idea. Generally I'll have a "dependencies" directory at the top level of the solution (or one higher if you have one), with all the DLLs that the projects use. Those are in source control, so when you check the code out, it will just work as-is, since the DLLs are all relative to the projects.
NuGet is the most common way to use external libraries and it places the dependencies in a folder called Packages at the root of the solution folder. You can create a folder called dependencies for your non-nuget dependencies. By placing this folder at the root of your solution you can make relative references so that works for everyone.
Better way to GAC all the DLL assemblies.
http://msdn.microsoft.com/en-us/library/ex0ss12c(v=vs.80).aspx
gacutil -i "DLL File Path"