如何改变在.NET中引用的加载路径?

编程入门 行业动态 更新时间:2024-10-25 18:25:40
本文介绍了如何改变在.NET中引用的加载路径?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我想这样的设置:

+- /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中引用的加载路径?

本文发布于:2023-11-10 10:41:13,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1575133.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:路径   加载   NET

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!