Windows/.net 在任何情况下都会自动将 DLL 放入 GAC 中吗

发布于 2024-09-26 14:42:39 字数 506 浏览 0 评论 0原文

我有一个引用 DLL 的程序。此 DLL 中的代码获取执行 DLL 的目录,并使用该目录来查找要加载的 XSD 文件(即我希望代码从 c:\foo\my.dll 执行,因此它看起来对于c:\foo\validation.xsd)。

在数以千计的客户安装中,我发现此功能运行良好。然而,在一种情况下,DLL 正在安装在 GAC 中。这意味着当它查找 XSD 文件时,它找不到它,因为给定的执行目录是 GAC 的目录而不是 c:\foo。

我的问题是:这是否是 Windows/.net 的一项功能,导致在某些情况下将其安装在 GAC 中?安装程序显然不会将 DLL 放入 GAC 中,否则我会到处出现这个问题。

我搜索了 Stackoverflow 和 Google,虽然有大量有关从 GAC 安装和删除文件的信息,但我找不到任何说明这可以自动发生的信息。我想知道客户站点的管理员是否手动将这些 DLL 放入其中。他们似乎不太可能打扰,但你永远不知道用户会做什么!

谢谢,

克桑萨拉斯

I have a program which references a DLL. Code in this DLL gets the directory of the executing DLL and uses that to look for an XSD file to load (i.e. I expect the code to be executing from c:\foo\my.dll so it looks for c:\foo\validation.xsd).

On of the thousands of customer installations I have this works fine. However in one case the DLL is being installed in the GAC. This means that when it looks for the XSD file it can't find it as the executing directory it is given is that of the GAC rather than c:\foo.

My question is: Is this a feature of Windows/.net which is causing it to be installed in the GAC under some circumstances? The installer clearly isn't putting the DLL in the GAC as a matter of course otherwise I would have this problem showing up all over the place.

I have search Stackoverflow and Google and while there is plenty of information on installing and removing files from the GAC I can't find anything which says that this can happen automatically. I wonder whether an administrator at the customer site is putting these DLLs in there manually. It seems unlikely that they would bother but you never know what users will do!

Thanks,

Xanthalas

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

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

发布评论

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

评论(2

南城旧梦 2024-10-03 14:42:39

我不相信它会自动发生,但如果使用相同依赖项的单独应用程序已在 GAC 中注册它,则可以解释您所看到的情况。在这种情况下,用户可能没有故意或故意对 DLL 进行任何操作。

I don't believe it happens automatically, but if a separate application which uses the same dependency has registered it in the GAC, that could explain what you're seeing. In that case the user may not have done anything with the DLL deliberately or knowingly.

你与清晨阳光 2024-10-03 14:42:39

有人可能会使用 Gacutil 在 GAC 中安装该程序集。

程序集不会自行安装在 GAC 中。

Someone would have installed the assembly in the GAC, probably using Gacutil.

Assemblies do not install themselves in the GAC.

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