将 DLL 存储在中央非 GAC 位置

发布于 2024-07-17 04:25:09 字数 662 浏览 5 评论 0原文

我们面临着一种独特的、痛苦的处境。 传统上,我们一直使用 GAC 和策略文件来控制 .NET 应用程序的 DLL 版本。 然而,我们的情况非常独特,并且遇到了重大问题,因为我们的一些应用程序不尊重策略文件。 最特别的是引用具有策略文件的 .NET 1.1 dll 的 .NET 2.0 应用程序。

我们拥有在 Windows 应用程序以及大量 Web 应用程序中动态运行(通过反射加载)的项目的混合组合。 我们希望转向更多的“集中式 DLL 存储”,而不是担心 GAC 版本控制。 但我们似乎找不到一种方法来告诉我们的应用程序“在此处查找任何 DLL”。

查看一些程序集信息节点 (http://msdn.microsoft.com /en-us/library/twy1dw1e.aspx)我们可以到达那里,但是我们必须定义每个应该查找的DLL,这是不可能的,因为我们有大约200个不同的应用程序需要当我们更新共享 DLL 的版本时,web.config 会定期更新。

有人知道如何移动 DLL 引用吗? CopyLocal 不是一个选项,因为我们有时需要应用程序使用新版本的共享 DLL。 至少目前,GAC 也不是一个真正的选择。

We are being presented with a unique, painful situation. Traditionally we have been using the GAC and Policy Files to control DLL versions for our .NET applications. However, we have a very unique situation and are running into major problems with this, as some of our applications do NOT respect the policy files. Most specifically the .NET 2.0 applications that reference .NET 1.1 dll's that have a Policy File.

We have a blended mix of items that run dynamically (loaded via reflection) in a windows application as well as a large number of web applications. We are looking to move to more of a "Centralized DLL Store" rather than worrying about GAC versioning. But we can't seem to find a way to tell our application to "Look here for any DLL's".

Looking at some of the assembly information nodes (http://msdn.microsoft.com/en-us/library/twy1dw1e.aspx) we can get part way there, but we must define each and Every DLL that should be looked up, this is not possible as we have about 200 different applications that would require regular web.config updates as we update versions of the shared DLLs.

Does anyone have a good idea on how we can move the DLL references? CopyLocal isn't an option as we have times where we NEED applications to use the new versions of the shared DLLs. The GAC, at least right now, isn't really an option either.

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

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

发布评论

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

评论(1

梦在夏天 2024-07-24 04:25:09

您可以在应用中使用代码库提示。 如果您想在 Machine.Config 文件中使用它,则

<?xml version="1.0"?>
<configuration>
  <runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
        <assemblyIdentity name="MyDll" />
        <codeBase version="1.0.1000.20000" href="file:///c:\SharedDlls" />
      </dependentAssembly>
    </assemblyBinding>
  </runtime>
</configuration>

您的 DLL 需要一个强名称(如果您来自 GAC 世界,并且 Microsoft 认证需要该名称,那么这对您来说应该不是问题)。

以下是 MSDN 博客上的链接,其中提供一些更深层次的建议。

You can use CodeBase hints in your app.config,

<?xml version="1.0"?>
<configuration>
  <runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
        <assemblyIdentity name="MyDll" />
        <codeBase version="1.0.1000.20000" href="file:///c:\SharedDlls" />
      </dependentAssembly>
    </assemblyBinding>
  </runtime>
</configuration>

Your DLL needs a stong name if you want to use this inside the Machine.Config file (should not be an issue for you if you came from the GAC world and it is required for Microsoft certifications).

Here is a link on an MSDN blog that gives some deeper advice.

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