我想要一个这样的设置:
I want a setup like this:
+- /ApplicationFolder -- App.exe -- Core.dll -- AnotherShared.dll +- /PluginsFolder -- plugin1.dll -- plugin2.dll但是,因为plugin1.dll引用Core.dll和Shared.dll,当我编译应用程序时会丢弃一个Copy.dll和Shared.dll到plugins文件夹以及如果我删除它们不起作用。
But because plugin1.dll references to Core.dll and Shared.dll when I compile the application it drops a copy of "Copy.dll" and "Shared.dll" to plugins folder as well and if I remove them it doesn't work any more.
我如何解决这个问题?
推荐答案创建AppDomain时,您可以定义加载程序集的路径。设置 AppDomainSetup.PrivateBinPath 并传递给AppDomain.Create域。
When you create an AppDomain you can define a path for loading assemblies. Set AppDomainSetup.PrivateBinPath and pass to AppDomain.Create domain.
使用AppDomain是一个好主意(允许不同的CAS和卸载)。
Using an AppDomain is a good idea for plugins (allows different CAS and unloading).
为了避免VS / msbuild将引用的程序集复制到输出目录,请更改复制本地在引用的属性中为false。
To avoid VS/msbuild copying referenced assemblies to the output directory, change "Copy Local" to false in the properties of the reference.
更多推荐
如何更改.NET中引用的加载路径?
发布评论