Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Safe to install production assemblies with gacutil.exe?

MSDN states that gacutil.exe is not safe to use for production servers. Is there a legitimate reason for this or is Microsoft just practicing a little CYA? Is this warning safe to ignore? Or should I finally learn how to use Microsoft Windows Installer 2.0?

MSDN's exact wording:

Gacutil.exe is only for development purposes and should not be used to install production assemblies into the global assembly cache.

like image 580
Jeff Avatar asked Jan 27 '12 18:01

Jeff


2 Answers

Items in the global assembly cache are shared across programs.

When you use Gacutil to add an assembly to the cache, there will be no reference counting of items that depend on it. Therefore, it is possible that when you use GacUtil /U to remove your library from the cache, you will have broken other programs that depend on it.

In contrast, Windows Installer 2.0 keeps a count and will only remove libraries from the assembly cache when no other program requires it.

like image 74
John Ruiz Avatar answered Sep 28 '22 08:09

John Ruiz


That's because gacutil.exe won't be available on the target machine. It is part of the Windows SDK, the .NET 4.0 version of it is located in C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bin\NETFX 4.0 Tools. You have it on your machine because you installed Visual Studio.

You simply do it with an installer. In a Setup project, right-click the File System pane, Add Special Folder and pick "Global Assembly Cache Folder". And put the DLL in there.

like image 24
Hans Passant Avatar answered Sep 28 '22 10:09

Hans Passant