DekGenius.com
[ Team LiB ] Previous Section Next Section

GacUtil.exe Global Assembly Cache Utility

Synopsis

gacutil command [options]

Description

Allows you to install, uninstall, and list the contents of the Global Assembly Cache (GAC).

Examples

Create a module, generate a key-pair, build a signed manifest assembly containing the module, and install the assembly in the GAC:

C:\home>csc /t:module Example.cs
Microsoft (R) Visual C# .NET Compiler version 7.10.3052.4
for Microsoft (R) .NET Framework version 1.1.4322
Copyright (C) Microsoft Corporation 2001-2002. All rights reserved.
  
C:\home>sn -k example.key
  
Microsoft (R) .NET Framework Strong Name Utility  Version 1.1.4322.573
Copyright (C) Microsoft Corporation 1998-2002. All rights reserved.
  
Key pair written to example.key
  
C:\home>al /keyfile:example.key /out:Example.dll Example.netmodule
Microsoft (R) Assembly Linker version 7.10.3077
for Microsoft (R) .NET Framework version 1.1.4322
Copyright (C) Microsoft Corporation 2001-2002. All rights reserved.
  
C:\home>gacutil /i Example.dll
  
Microsoft (R) .NET Global Assembly Cache Utility.  Version 1.1.4322.573
Copyright (C) Microsoft Corporation 1998-2002. All rights reserved.
  
Assembly successfully added to the cache

Delete all assemblies named Example from the GAC:

C:\home>gacutil /u Example
  
Microsoft (R) .NET Global Assembly Cache Utility.  Version 1.1.4322.573
Copyright (C) Microsoft Corporation 1998-2002. All rights reserved.
  
Assembly: Example, Version=2.0.0.0, Culture=neutral, 
PublicKeyToken=9a587aa1499c251f, Custom=null
Uninstalled: Example, Version=2.0.0.0, Culture=neutral, 
PublicKeyToken=9a587aa1499c251f, Custom=null
  
Number of items uninstalled = 1
Number of failures = 0

Find a list of all assemblies named Example and delete a specific version:

C:\home>gacutil /l Example
  
Microsoft (R) .NET Global Assembly Cache Utility.  Version 1.1.4322.573
Copyright (C) Microsoft Corporation 1998-2002. All rights reserved.
  
The Global Assembly Cache contains the following assemblies:
  Example, Version=1.0.0.0, Culture=neutral,
    PublicKeyToken=093bfe6ba64f6b38, Custom=null
  Example, Version=1.2.0.0, Culture=neutral, 
    PublicKeyToken=4644a63cb9786bcc, Custom=null
  
The cache of ngen files contains the following entries:
  
Number of items = 2
  
C:\home>gacutil /u Example,Version=1.2.0.0
  
Microsoft (R) .NET Global Assembly Cache Utility.  Version 1.1.4322.573
Copyright (C) Microsoft Corporation 1998-2002. All rights reserved.
  
Assembly: Example, Version=1.2.0.0, Culture=neutral, 
PublicKeyToken=4644a63cb9786bcc, Custom=null
Uninstalled: Example, Version=1.2.0.0, Culture=neutral, 
PublicKeyToken=4644a63cb9786bcc, Custom=null
  
Number of items uninstalled = 1
Number of failures = 0

Commands

/?

Displays usage information and exits.

/cdl

Removes all assemblies that were downloaded from the network.

/i [/f] [/r] assemblypath

Installs the specified assembly into the GAC. The assembly must have a strong name (see Sn.exe).

/il [/f /r] assemblylistfile

Installs one or more assemblies into the GAC. assemblylistfile is a file that contains a cr/lf-delimited list of assembly file names.

/l [/r] [ name]

Lists all assemblies in the GAC. If you supply a name, it lists all versions of the named assembly.

/ldl

Lists all assemblies that were downloaded from the network.

/nologo

Suppresses display of the banner and copyright messages.

/silent

Suppresses display of all console output.

/u [/f] [/r] assembly

Remove an assembly from the GAC.

/ul [/r] assemblylistfile

Removes one or more assemblies from the GAC. assemblylistfile is a file that contains a cr/lf-delimited list of assembly file names.

/ungen assembly

Removes an assembly from the cache of ngen'd files (see Ngen.exe).

Options

/f

Use with the /i or /il commands to force installation, even if the assembly already exists. With /u, /f forces removal by uninstalling all traced references (this fails if the assembly is referenced by the Windows Installer).

/r scheme id description

Specifies a traced reference (use this with /i, /il, /u, or /ul). Valid options for scheme are FILEPATH (id must be a path to a file), UNINSTALL_KEY (id must be a registry key), or OPAQUE (id must be an identifier). id is the referencing application's identifier (for a scheme of FILEPATH, it would be the application's full path), and description is a friendly name for the referencing application.

See Also

Sn.exe, Al.exe, Csc.exe

    [ Team LiB ] Previous Section Next Section