Recently a number of people have been asking about deploying assemblies into the GAC (Global Assembly Cache) using GacUtil.exe. Now GacUtil is strictly a developer tool, and is not intended to be used for general deployment of assemblies, but I can see how some confusion has arisen. Some recent service packs, including .NET 1.1 SP1 and Windows Server 2003 SP1, accidentally left GacUtil.exe behind after installation in the %SystemRoot%\Microsoft.NET\Framework\v1.1.4322 directory. This has led some people to believe that we were shipping GacUtil as part of the .NET Framework.

I contacted the team that own GacUtil.exe, and this was their response, “GacUtil never was moved to the framework from the SDK. It's always only legitimately shipped in the SDK. GacUtil got mistakenly left behind on customer machines after an install of an SP, which is what gives the impression it shipped with the redist. This is being corrected. End-users should not be using GacUtil. This is a dev-only tool, and on retail machines, MSI is the way to install assemblies to the GAC.” Now because the .NET SDK doesn't have a redistribution licence, it means than you would be infringing the licence agreement if you were to include GacUtil as part of your application installation.

So, the recommendation is to use MSI, but not everybody uses MSIs and I've been asked on a number of occasions if there is a .NET API that can be used to install assemblies in the GAC. Well the short answer is no, but there is a Win32 API that you can call through P/Invoke. An example of this can be found here. So there is no reason why you can't develop your own GacUtil if you so wish.

-- Dave