将文件安装到 GAC 的代码似乎不起作用

发布于 2024-10-24 23:09:51 字数 424 浏览 6 评论 0原文

基本上,我们遇到了这样的情况:无论出于何种原因,我们都必须将一些第 3 方 dll 放入 GAC 中才能使其正常工作。 (程序集已加载,但有奇怪的行为,并且在加载的程序集中查找类型时遇到问题。应用程序本身是另一个第三方程序的添加,因此它必须与加载方式有关。)所以我尝试编写一些快速的代码代码来处理这个问题,而不必在每台需要它的机器上手动执行此操作。

代码基本上可以归结为:

Dim X As New System.EnterpriseServices.Internal.Publish
X.GacInstall(name)

其中 name 是 dll 的文件名。这运行没有错误。它甚至将程序集添加到 GAC 中。但是,应用程序仍然遇到相同的问题,直到您在 .Net 配置窗口中手动添加程序集。

您认为我的代码中还需要执行另一个步骤吗?

Basically we ran into where, for whatever reason, we had to put some 3rd party dll in the GAC for it to work correctly. (The assemblies loaded, but had weird behavior and trouble finding types in the loaded assemblies. The app itself is a add in to another 3rd party program, so it must be something about how its being loaded.) So I tried to write some quick code to handle this without having to manually do this on each machine it was needed on.

This is basically what the code boils down to:

Dim X As New System.EnterpriseServices.Internal.Publish
X.GacInstall(name)

Where name is the filename of the dll. This runs without error. It even add the assembly to the GAC. However, the application still experiences the same issue until you manually add the assembly in .Net Configuration window.

Do you think there is another step that needs to be done in my code?

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

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

发布评论

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

评论(1

瑕疵 2024-10-31 23:09:51

如果您对 Windows 目录启用了管理员权限,则可能无法安装。

If you have administrator permissions enabled on windows directory, this might fail to install.

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