How to change the loading path of references in .NET?

前端 未结 3 1136
逝去的感伤
逝去的感伤 2021-01-16 07:20

I want a setup like this:

+- /ApplicationFolder
  -- App.exe
  -- Core.dll
  -- AnotherShared.dll
  +- /PluginsFolder
    -- plugin1.dll
    -- plugin2.dll
<         


        
3条回答
  •  栀梦
    栀梦 (楼主)
    2021-01-16 07:43

    When you create an AppDomain you can define a path for loading assemblies. Set AppDomainSetup.PrivateBinPath and pass to AppDomain.Create domain.

    Using an AppDomain is a good idea for plugins (allows different CAS and unloading).

    To avoid VS/msbuild copying referenced assemblies to the output directory, change "Copy Local" to false in the properties of the reference.

提交回复
热议问题