1. Home
  2. Computing & Technology
  3. Visual Basic

GACUTIL - Sharing your work in the Global Assembly Cache - A Framework Tool
Just What Is a GACUTIL?

By , About.com Guide

Previously in this series, I've discussed ILDASM, for examining the Intermediate Language that is generated by the VB.NET compiler and NGEN, for creating genuine native code executable programs just like the good ol' days. The third .NET Framework tool we'll look at is gacutil. This one is far less familiar to most programmers and, in fact, the target of the tool, the Global Assembly Cache - you'll see it written "GAC" most of the time - may not be familiar either. The gacutil tool is strictly for developers and even then will probably be used by a just a few of the programmers who concentrate on working out the special problems of deployment and configuration.

We briefly encountered the GAC in the article about NGEN because the compiled native code assemblies that are produced by NGEN are stored in the GAC.

One of the ways you can check on results after running NGEN is to look in the GAC for the assembly. Usually, the GAC is located at C:\WINDOWS\assembly.

Since gacutil works with assemblies in the GAC, let's review .NET assemblies in .NET. An assembly is the basic unit used by the .NET CLR (Common Language Runtime) for deployment, version control, security, type grouping and code reuse. So, when you run your VB.NET program, you're executing the assembly. A "single file" assembly will be an EXE or DLL file.

If you're new to .NET, you might think that Microsoft just thought up another name for the same old thing, but there's much more to assemblies. This is a huge part of the "secret sauce" that makes .NET a completely new and different world. An assembly consists of a manifest and one or more modules and/or files. The manifest makes an assembly "self describing" so the .NET CLR can make sure that it's the right one. Among other things, the manifest identifies the assembly, describes its security requirements, lists other assemblies it depends on, and lists all of the types and resources exposed by the assembly.

This lets .NET accomplish what is called, "side by side execution". This is when multiple versions of the same assembly execute at the same time on the same PC or within the same process. Information in the assembly allows .NET to keep track of them. This is also why .NET programs don't have to be "registered" like programs (still) do using the previous idea, COM. In my article about ILDASM, I pointed out that one of its main uses is to view what is actually in the manifest.

"But wait!" I hear you saying, "My program assembly isn't in any GAC, it's right there in the BIN directory with my application." Assemblies are of two types: application private and shared. The default is application private and only one application uses them. These are the assemblies that are in the application folder. A shared assemblies is meant to be used by more than one application. It has a globally unique name (called a "strong name") and it must be defined in the GAC. gacutil will list, install, and uninstall assemblies in the GAC.

Explore Visual Basic
By Category
About.com Special Features

Holiday Central

What to eat, where to go, fun things to do and how to save money on the perfect gifts. More >

Family Tech Center

Stay connected and entertained with reviews on tips on the latest HDTVs, cellphones and more. More >

  1. Home
  2. Computing & Technology
  3. Visual Basic
  4. Using VB.NET
  5. GACUTIL - Sharing your work in the Global Assembly Cache - A Framework Tool

©2009 About.com, a part of The New York Times Company.

All rights reserved.