Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles
(untagged)

How to Install gacutil.exe on a Windows Server

0.00/5 (No votes)
21 Oct 2015 1  
This article outlines the steps for installing the Global Assembly Cache Tool on Windows Server 2008.

Problem

I have a customer using Windows Server 2008 for hosting its ASP.NET web applications. The operating environment on the server is kept very clean and lightweight, so only the bare necessities are installed. For example, there are no office productivity tools (like Office) or integrated development tools (like Visual Studio) installed in these environments. This is definitely a good practice; it keeps the potential attack surface small, and it helps to ensure that the server runs as fast as possible, without any potential for bogging down due to unnecessary programs or processes.

All of the web applications on this particular server rely on a Microsoft.NET assembly from a third-party software component vendor. The assembly DLL file is over 14 MB, which is relatively large, so we decided to move the DLL into the Global Assembly Cache (GAC) so it can be shared by all applications. Previously, a copy of the DLL was installed in the bin directory for every application that used it. This was wasteful of resources, and more difficult to maintain when the vendor released updates to the assembly.

You will recall the global assembly cache is machine-wide code cache that stores assemblies that are specifically intended for sharing by several applications on the computer. The Global Assembly Cache Tool (gacutil.exe) allows you to install assemblies into the cache, remove them from the cache, and list the contents of the cache. Using the tool to install an assembly into the cache is simple:

C:\> gacutil /i BigAssembly.dll

However, the gacutil executable did not exist anywhere on the server.

According to Microsoft, gacutil.exe is considered to be a development tool. Because of this, it is contained in the .NET SDK and not in the .NET redistributable. Visual Studio comes with the SDK, so if you have Visual Studio installed, then this tool is installed with it. For example, on my development machine, the executable file is located here:

C:\Program Files\Microsoft SDKs\Windows\v7.1\Bin\NETFX 4.0 Tools\x64\

The application server has the .NET redistributable installed, but it does not have the .NET SDK installed, therefore this folder did not exist on the server, and there was no gacutil.exe.

Solution

One solution is to download and install the Microsoft Windows SDK for Windows 7 and .NET Framework 4. Version 7.1, published on May 19 of 2010, is available for free download here:

After downloading winsdk_web.exe, you can run the program with administrator permissions, and select the .NET Installation Options.

The installation takes a few minutes to run, and after it completes, the Global Assembly Cache Tool is ready to use.

C:\Program Files\Microsoft SDKs\Windows\v7.1\Bin\NETFX 4.0 Tools\gacutil.exe

I found this to be the simplest solution, although there are alternatives for adding assemblies to the GAC without installing the .NET SDK and without using gacutil.exe at all:

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here