DISCOVER
×

How to Clean the Global Assembly Cache

Updated April 17, 2017

The Global Assembly Cache (GAC) is a folder in the Windows directory that stores assemblies common to multiple applications. An assembly is a single, compiled unit that contains information about all files and resources in a .NET application. The .Net framework comes with pre-installed assemblies. Developers can also place assemblies into the GAC to share them with other applications. Microsoft notes that you do not generally need to remove items from the Global Assembly Cache. However, they provide tools needed to clean the GAC.

Click the Windows "Start" menu and type "Visual Studio." Windows will return a list of search results.

Locate an entry that has "Command Prompt" in the name. The wording that you see will differ depending on your version of Visual Studio. For example, if you use Visual Studio 2005, you will see "Microsoft Visual Studio 2005 Command Prompt." Click that item. The "Command Prompt" window will open.

Type the following in the "Command Prompt" window:

Gacutil --l

Press "Enter." Windows will display a list of the assemblies in the Global Assembly Cache.

Click the "C" icon at the top of the window and select "Edit" and then "Mark." Hold down your left mouse button and highlight the assembly that you want to remove from the GAC. Click the "C" icon again and select "Edit" and then "Copy." This copies the assembly name to your clipboard.

Type the following in the window:

gacutil --u PASTE ASSEMBLY NAME HERE

Click the "C" icon at the top of the window and select "Edit" then "Mark." Hold down your left mouse button and highlight "PASTE ASSEMBLY NAME HERE." Click the "C" icon, select "Edit" and then "Paste." Windows will paste the name that you copied. For example, if you copied an assembly named "Calculate," the final command might look like this:

gacutil /u "Calculate,Version=1.0.0.0, Culture=neutral, PublicKeyToken=0123456789ABCDEF"

Press "Enter" to execute the command. Remove other assemblies from the GAC as needed.

Tip

To clean the Global Assembly Cache, you must log on to your computer as an administrator or use an account that has permission to write the GAC. Microsoft suggests not placing assemblies into the Global Assembly Cache if you plan to copy your application to another location using xcopy.

bibliography-icon icon for annotation tool Cite this Article

About the Author

After majoring in physics, Kevin Lee began writing professionally in 1989 when, as a software developer, he also created technical articles for the Johnson Space Center. Today this urban Texas cowboy continues to crank out high-quality software as well as non-technical articles covering a multitude of diverse topics ranging from gaming to current affairs.