How to move all referenced DLLs into seperate folder in c#?

后端 未结 2 2019
情话喂你
情话喂你 2020-12-15 14:09

I have a solution with 3 projects in it. 2 of the projects are referencing log4net, and a couple of others DLLs.

When I create the install package and add project o

相关标签:
2条回答
  • 2020-12-15 14:52

    I wrote a nuget package, called PrettyBin for this purpose It addes a post build target to a project, that moves dlls to a "lib" subfolder, and modifies app.config to look there

    0 讨论(0)
  • 2020-12-15 15:05

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

    This allows you to specify paths that are sub-paths of your application directory which Fusion should search when trying to find assemblies to bind to. An example (taken from the documentation page) is:

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

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

    0 讨论(0)
提交回复
热议问题