1
votes

I have a project that I am working on that references a "Common Library (DLL)". In the DevEnv it works fine, however if I build and try to organize my files it doesn't work. Basically if I have things setup like so:

  • C:\Program Files\MyApp\MyApp.exe
  • C:\Program Files\MyApp\Common\WPF Commons.dll
  • C:\Program Files\MyApp\Modules\SomeModule.dll
  • etc

MyApp.exe doesn't work. It tries to look only in the current directory for the DLL files. So how do I set it up in Visual Studio so that when I build the application knows to look for the DLLs in those other folders?

Oh, and I realize that it does work in Dev because all the DLLs are put in the same folder. I don't want to do that for release though :-/

1

1 Answers

3
votes

What you need to do is add a private probing path into the application configuration file. This tells the CLR which directories to look in for extra assemblies.

Sample app.config

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