将文件安装到 GAC 的代码似乎不起作用
基本上,我们遇到了这样的情况:无论出于何种原因,我们都必须将一些第 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 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您对 Windows 目录启用了管理员权限,则可能无法安装。
If you have administrator permissions enabled on windows directory, this might fail to install.