How does Windows Update install .NET assemblies in the GAC?

1.9k views Asked by At

Consider the following command

gacutil /i Microsoft.Powershell.ConsoleHost.dll

This will install the assembly to

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

Now, consider a different computer without gacutil. You can install this update and the same assembly will be installed to the same place. How is this update installing to the Global Assembly Cache without gacutil?

1

There are 1 answers

1
CodeCaster On BEST ANSWER

Any assembly should (and in this specific case most likely will) be installed using an installer.

From MSDN: How to: Install an Assembly into the Global Assembly Cache:

Using Windows Installer. This is the recommended and most common way to add assemblies to the global assembly cache. The installer provides reference counting of assemblies in the global assembly cache, plus other benefits. [...] Gacutil.exe is only for development purposes and should not be used to install production assemblies into the global assembly cache.

From MSDN: Installation of Assemblies to the Global Assembly Cache:

The Windows Installer installs common language runtime assemblies into the global assembly cache using the Microsoft .NET Framework.

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

The native code application programming interfaces (APIs) that allow you to interact with the Global Assembly Cache (GAC) are not documented in the .NET Framework Software Development Kit (SDK) documentation.

The actual installation seems to take place through IAssemblyCache::InstallAssembly().