我想这样的设置:
+- /ApplicationFolder -- App.exe -- Core.dll -- AnotherShared.dll +- /PluginsFolder -- plugin1.dll -- plugin2.dll
但由于plugin1.dll引用Core.dll和Shared.dll当我编译应用程序它滴Copy.dll和Shared.dll,以插件的副本文件夹好,如果我删除它们没有关系'T工作了。
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.
我该如何解决这个问题呢?
How can I solve this problem?
推荐答案当你创建一个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中引用的加载路径?
发布评论