Click here to Skip to main content
15,882,113 members
Articles / DevOps
Tip/Trick

How to Install gacutil.exe on a Windows Server

Rate me:
Please Sign up or sign in to vote.
4.29/5 (5 votes)
21 Oct 2015CPOL3 min read 117.4K   4   2
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, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Chief Technology Officer Shift iQ
Canada Canada
I have been building software systems for more than 20 years, working for organizations that range from small non-profit associations in my local community to global Fortune 500 enterprises.

I specialize in the design and implementation of online database solutions. My work-related research interests include software design patterns and information architecture.

Comments and Discussions

 
GeneralMy vote of 5 Pin
dmjm-h22-Oct-15 10:46
dmjm-h22-Oct-15 10:46 
GeneralRe: My vote of 5 Pin
Daniel Miller22-Oct-15 11:43
professionalDaniel Miller22-Oct-15 11:43 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.