Tuesday, 6 January 2015

Global Assembly Cache Tool

Where is gacutil.exe on my Windows server?

All of our production servers run Microsoft Windows Server 2008, and we keep the environment clean and lightweight. For example, we never install office productivity tools (like Microsoft Office) or integrated development tools (like Visual Studio) on our production servers. This keeps the 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.

We have a number of web applications on one server in particular, and all of these applications rely on a Microsoft.NET assembly from a third-party. At 14 MB, the DLL is relatively large, and so we decided to move the DLL into the Global Assembly Cache (GAC). Until now, a copy of the DLL has been installed in the bin directory for every application that uses it. This is wasteful of resources, and more difficult to maintain when the vendor releases updates to the assembly.

You will recall that 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 mydll.dll

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 was installed with it. On my development machine the executable file is located here:

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

Our production server has the .NET redistributable installed, but it does not have Visual Studio or the .NET SDK installed, therefore this folder does not exist on our production server.

The simplest 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, 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 installing assemblies in the GAC without using gacutil.exe:

No comments:

Post a Comment