【问题标题】:How does Windows Update install .NET assemblies in the GAC?Windows Update 如何在 GAC 中安装 .NET 程序集?
【发布时间】:2014-11-28 06:22:30
【问题描述】:

考虑以下命令

gacutil /i Microsoft.Powershell.ConsoleHost.dll

这会将程序集安装到

C:\Windows\Microsoft.NET\assembly\GAC_MSIL\Microsoft.PowerShell.ConsoleHost

现在,考虑另一台没有gacutil 的计算机。你可以安装 this update 和一样 组件将安装到同一个地方。此更新如何安装到 没有gacutil全局程序集缓存

【问题讨论】:

  • 是什么让你相信更新要么没有使用gacutil,要么没有做与gacutil相同的事情(我的意思是后者,微软拥有gacutil工具和更新/安装程序等。他们最终都实现了。)
  • 酷..那么你知道安装程序不使用Gacutil。更新/安装程序如何将程序集添加到 GAC。不知道他的详细信息,但 MS 为安装程序编写了代码。如果我仍然错过了你的问题,我很抱歉。
  • any code可以使用fusion api,不需要gacutil。

标签: .net gac windows-update gacutil


【解决方案1】:

任何程序集都应该(并且在这种特定情况下很可能会)使用安装程序进行安装。

来自MSDN: How to: Install an Assembly into the Global Assembly Cache

使用 Windows 安装程序。这是将程序集添加到全局程序集缓存的推荐且最常用的方法。安装程序在全局程序集缓存中提供程序集的引用计数,以及其他好处。 [...] Gacutil.exe 仅用于开发目的,不应用于将生产程序集安装到全局程序集缓存中。

来自MSDN: Installation of Assemblies to the Global Assembly Cache

Windows Installer 使用 Microsoft .NET Framework 将公共语言运行时程序集安装到全局程序集缓存中。

来自MSDN: DOC: Global Assembly Cache (GAC) APIs Are Not Documented in the .NET Framework Software Development Kit (SDK) Documentation(通过SO: Drag and drop a DLL to the GAC (“assembly”) in windows server 2008 .net 4.0):

.NET Framework 软件开发工具包 (SDK) 文档中未记录允许您与全局程序集缓存 (GAC) 交互的本机代码应用程序编程接口 (API)。

实际安装似乎是通过IAssemblyCache::InstallAssembly()进行的。

【讨论】:

  • 参见(ninja-)编辑:操作 GAC 的实际 .NET API 没有(彻底)记录在案。除了 gacutil,我知道没有任何命令行工具。
猜你喜欢
  • 2023-04-04
  • 2011-06-19
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多