是否可以将程序集作为某种“链接程序集”安装到 GAC 中?

发布于 2024-08-04 14:16:53 字数 210 浏览 2 评论 0原文

我正在尝试部署某种框架,因此需要在 GAC 中注册一些程序集。

有趣的部分是: 这些 GAC 程序集只能由框架开发人员使用,客户端应用程序不应使用这些 GAC 程序集,而应使用其本地目录中的 GAC 程序集(GAC 程序集可能是不同版本,很可能更高)。

我已经找到并尝试了 app.config 设置,但客户端应用程序似乎忽略了它(安装的最新 .NET 运行时是 3.5)。

I'm trying to deploy some sort of framework and therefore need to register some assemblies in the GAC.

The interesting part is:
These GAC assemblies should only be used by the framework developer, the client apps should not use these GAC assemblies but the ones in their local directories (the GAC assemblies could be of a different version, most likely higher).

I've already found and tried the app.config setting but it seems to be ignored by the client app (latest .NET runtime installed is 3.5).

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

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

发布评论

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

评论(1

仙气飘飘 2024-08-11 14:16:53

因为您将在内存中加载给定 dll 的两个不同版本,所以需要将它们隔离。常见的方法有;

  1. 创建应用程序域。您创建两个 dll。第一个 dll 从您的代码创建一个新的 AppDomain,然后加载链接到这些依赖项的第二个 dll。
  2. 使用服务流程。您创建一个 dll 和一个服务应用程序。 dll 在新进程中启动服务应用程序并进行连接,例如远程处理。服务应用程序链接到您需要绑定的组件。

Because you will be loading two different versions of a given dll in the memory you need to isolate them. common methods are;

  1. Creating an AppDomain. You create two dll's. The first dll creates a new AppDomain from your code and then loads the second dll which is linked to those dependencies.
  2. Use a service process. You create one dll and a service application. The dll starts the service application in a new process and connects using for e.g. remoting. The service application is linked to the components you need to bind to.
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文