.NET 4.0 GAC - 无法添加 DLL

发布于 2025-01-04 00:10:20 字数 951 浏览 0 评论 0原文

我使用命名空间 System.Windows.Forms.DataVisualization.Charting 在表单上创建一个 Chart 对象。该 DLL 不是基本 Windows 安装的一部分,因此当我分发应用程序时,我需要将其包含在我的包中。

我知道新版本的GacUtil.exe并且另外, Gacutil.exe 仅用于开发目的,不应用于将生产程序集安装到全局程序集缓存中。 让我们假设我在这件事上别无选择,并且由于使用专有的程序包分发系统而必须这样做。 =)

编辑/更新: 在 2.0 运行时中,即使某些 PC 的预期安装 PC 上没有 GacUtil.exe,我也可以将 GacUtil.exe(2.0 版本)放在 PC 上,然后我然后 GAC 可以提供我需要的任何额外组件。这似乎是 4.0 运行时的问题。尽管我已将 GacUtil.exe (4.0) 复制到目标 PC,但在针对所需程序集运行它时我没有得到任何反馈。 结束编辑/更新

现在,在我的电脑(开发电脑)上,我可以毫无问题地将 DLL 添加到 GAC 中: 我的电脑上的命令提示符

但是,在干净的 Windows 7 电脑上,具有相同的 DLL 和相同版本的 GacUtil.exe我明白了: 干净电脑上的命令提示符

为什么会出现差异?新的 GacUtil.exe 是否依赖于这台电脑没有的东西?

I am using the namespace System.Windows.Forms.DataVisualization.Charting to create a Chart object on a form. This DLL is not a part of the basic Windows install, so I shall need to include it in my package when I distribute my application.

I am aware of the new version of GacUtil.exe and also that Gacutil.exe is only for development purposes and should not be used to install production assemblies into the global assembly cache. Let's just assume that I have no choice in the matter and have to do it this way due to the use of a proprietary package distribution system. =)

Edit/Update: In the 2.0 runtime, even though some PC's did not have GacUtil.exe present on the intended installation PC, I could drop GacUtil.exe (2.0 version) on the PC and I could then GAC whatever extra assemblies I needed. This appears to be a problem in the 4.0 runtime. Even though I have copied GacUtil.exe (4.0) to the destination PC, I get no feedback when running it against the needed assembly. End Edit/Update

Now, on my PC (the development PC), I can add the DLL to the GAC without any problems:
Command Prompt On My PC

However, on a clean Windows 7 PC, with the same DLL and the same version of GacUtil.exe I get this:
Command Prompt On Clean PC

Why the discrepancy? Does the new GacUtil.exe depend upon something that this PC doesn't have?

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

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

发布评论

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

评论(2

一杯敬自由 2025-01-11 00:10:21

好吧,我最终遇到了两个问题,其中一个最终成为了一个有争议的问题。

问题#1:GacUtil.exe(对于 4.0 CLR)具有依赖项

当我复制 GacUtil.exe 所在的文件夹时,添加程序集的问题消失了:
Successful GAC on Clean PC

然而,这最终成为一个有争议的问题,因为即使该文件位于 4.0 GAC 中客户端机器,我仍然崩溃了。那时我意识到问题在于我的目标不是 4.0 GAC - 我的目标是 2.0 GAC。我一直试图添加到 GAC 的文件是该文件的 4.0 版本。这是我不理解的部分。

问题#2:“GACable”DLL 有单独的 4.0 和 2.0 版本,并且它们不向后兼容

我只是回到我的开发计算机并获取有问题的 DLL 的 3.5 版本(系统.Windows.Forms.DataVisualization),将其添加到客户端 PC 上的 2.0 GAC 中,并避免了危机。

Ok, I ended up having two problems, one of them being a moot point in the end.

Problem #1: GacUtil.exe (for the 4.0 CLR) has Dependencies

When i copy over the folder in which GacUtil.exe resides, the problem of adding the assembly vanishes:
Successful GAC on Clean PC

This ended up being a moot point, however, because even though the file was in the 4.0 GAC on the client machine, I still had the crash. I realized at that point that the problem was that I am not targeting the 4.0 GAC - I'm targeting the 2.0 GAC. The file I was trying to add to the GAC this whole time was a 4.0 version of the file. This was the piece I wasn't understanding.

Problem #2: There are separate 4.0 and 2.0 versions of "GACable" DLL's, and they are not backwards compatible

I simply went back to my development machine and grabbed the 3.5 version of the DLL in question (System.Windows.Forms.DataVisualization), added it to the 2.0 GAC on the client PC, and crisis averted.

幸福丶如此 2025-01-11 00:10:21

如果您添加“1033”子文件夹并包含文件 gacutlrc.dll,您可以从您自己的文件夹运行 4.0 Gacutil,该文件可以在以下位置的同一子文件夹中找到标准位置。

You can run the 4.0 Gacutil from your own folder if you add a "1033" subfolder and include the file, gacutlrc.dll, which can be found in the same subfolder in the standard location.

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