views:

13

answers:

1

(This might be a obvious question but I wasn't sure what to ask Bing/Google)

In a VS2008 (C# Winforms) project there are numerous third party libraries that are referenced. The project uses 'Copy Local = True' so that the various DLL files end up in the same folder as the compiled application.

To clean things up I would like to modify the program so that the libraries are all under a subfolder.

For example:

C:\MyProgram\ -> main program folder C:\MyProgram\Libraries -> DLL storage folder

How would I do this?

+1  A: 

The best way to do this is to add an app.config file to your solution and setup private probing paths for each of the sub folders. The CLR will then look in these folders when searching for assemblies

<configuration>
   <runtime>
      <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
         <probing privatePath="subFolder1;subFolder2;" />
      </assemblyBinding>
   </runtime>
</configuration>

Documentation

JaredPar
When I rebuild the application errors appear that the references can't be found. Is there anything special that needs to be done with the path naming?
John M
@John M, no it simply needs to match the names in app.config. Note you can't use this approach and delete all of your assembly references. They need to still be maintained for the purpose of building. The app.config file just helps in deployment scenarios.
JaredPar