替换运行时动态查找程序集的位置

发布于 2024-11-17 11:11:48 字数 284 浏览 12 评论 0原文

我们有一个应用程序,下面有一些“Utils”(一些简单的程序)。

这些实用程序依赖于我们的应用程序也在使用的一些共享 DLL,因此,我们只想将这些 DLL 分发一次(放置在 APP_BASE\bin 下)。

我们正在寻找一种解决方案,其中 utils(位于 APP_BASE\Utils 下)将能够在 bin 文件夹(与其基本目录下不相关)中查找。

我知道 .NET 标准配置文件允许这样做,仅适用于相对路径下的程序集。

还有其他选择吗? 我们的 DLL 未签名,也不置于 GAC 之下。

We have an application that has some "Utils" under it (a few simple programs).

These utils are relying on a few shared DLLs that our application is also using, and so, we would like to distribute these DLLs only once (placed under APP_BASE\bin).

We're looking for a solution, where the utils (placed under APP_BASE\Utils) will be able to lookup in the bin folder (which is NOT RELATIVE under its base dir).

I know that the .NET standard config file allows doing so, only for assemblies that are under relative paths.

Is there any other option for doing so?
Our DLLs are not signed and are not placed under the GAC.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

野味少女 2024-11-24 11:11:48

您可以使用 AssemblyResolve 事件。
我们使用此事件来加载 x86\x64 dll,具体取决于用户的平台。

FIY 作为解决方法,您也可以使用 .net developmentMode

指定运行时是否在 DEVPATH 环境变量指定的目录中搜索程序集。

You can use AssemblyResolve event.
We are using this event for loading x86\x64 dlls depending of User's platform.

FIY as a workaround you can also use .net developmentMode

Specifies whether the runtime searches for assemblies in directories specified by the DEVPATH environment variable.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文