How to move all linked DLLs to a separate folder in C #?

I have a solution with three projects. 2 of the projects link to log4net and several other DLLs.

When I create the installation package and add the project output for each of the projects, it drops the DLLs into the main "application folder". If I drag these DLLs into a separate folder created in the installation project, the applications will not start saying "I can not find log4net". I want these DLL links to be something like "bin" or some real name, and not in the main folder to which they add confusion. I just need my 2.exe in the main folder.

I tried adding a reference path in each project to point to the bin folder. Then, in the installation project, I added an output folder with the name "bin" and moved the DLL to this folder, but still does not work.

What am I missing! I spent a couple of hours looking around, trying to understand what I was doing wrong, perhaps that was how I was born! Thanks for any help!

+4
source share
2 answers

You can use the <probing> element in the app.config file to specify the private path for Fusion (assembly loader) to search in.

This allows you to specify the paths that are subdirectories of your application directory that Fusion should look for when trying to find assemblies for binding. Example (taken from the documentation page):

 <configuration> <runtime> <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> <probing privatePath="bin;bin2\subbin;bin3"/> </assemblyBinding> </runtime> </configuration> 

This means that Fusion will look in the subdirectories bin, bin2 \ subbin (but not bin2, IIRC) and bin3 for assemblies when trying to bind to them.

+10
source

I wrote a nuget package called PrettyBin for this purpose. It adds a post build goal to the project, which moves the dll to the lib subfolder and modifies app.config to look there

+3
source

All Articles