0

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?

CodeCaster
  • 147,647
  • 23
  • 218
  • 272
Zombo
  • 1
  • 62
  • 391
  • 407
  • What makes you believe that the update is either not using `gacutil` or not doing same thing as `gacutil` (By latter I mean, Microsoft owns both the `gacutil` tool, and the update / installer etc.. They implement both in the end.) – Vikas Gupta Nov 27 '14 at 22:01
  • Cool.. then you know installers don't use `Gacutil`. How does update / installer add the assembly to GAC.. Don't know he details, but MS wrote the code for the installer to do so.. I am sorry if I am still missing the point of your question. – Vikas Gupta Nov 27 '14 at 22:09
  • 2
    The fusion api is usable by [any code](http://stackoverflow.com/a/2611435/17034), it doesn't require gacutil. – Hans Passant Nov 27 '14 at 23:28

1 Answers1

2

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().

Community
  • 1
  • 1
CodeCaster
  • 147,647
  • 23
  • 218
  • 272
  • See (ninja-)edit: the actual .NET APIs to manipulate the GAC are not (thoroughly) documented. There is no command-line tool that I know of, other than gacutil of course. – CodeCaster Nov 27 '14 at 22:08