Global Assembly Cache Tool (Gacutil.exe)

Global Assembly Cache Tool (Gacutil.exe)

The Global Assembly Cache tool allows you to view and manipulate the contents of the global assembly cache and download cache.

Examples

The following command installs the assembly mydll.dll into the global assembly cache.

gacutil /i mydll.dll

The following command removes the assembly hello from the global assembly cache as long as no reference counts exist for the assembly.

gacutil /u hello

Note that the previous command might remove more than one assembly from the assembly cache because the assembly name is not fully specified. For example, if both version 1.0.0.0 and 3.2.2.1 of hello are installed in the cache, the command gacutil /u hello removes both of the assemblies.

Use the following example to avoid removing more than one assembly. This command removes only the hello assembly that matches the fully specified version number, culture, and public key.

gacutil /u hello, Version=1.0.0.1, Culture="de",PublicKeyToken=45e343aae32233ca

The following command installs the assemblies specified in the file assemblyList.txt into the global assembly cache.

gacutil /il assemblyList.txt

The following command removes the assemblies specified in the file assemblyList.txt from the global assembly cache.

gacutil /ul assemblyList.txt

The following command installs myDll.dll into the global assembly cache and adds a reference to count it. The assembly myDll.dll is used by the application MyApp. The UNINSTALL_KEY MyApp parameter specifies the registry key that adds MyApp to Add/Remove Programs in Windows. The description parameter is specified as My Application Description.

gacutil /i /r myDll.dll UNINSTALL_KEY MyApp "My Application Description"

The following command installs myDll.dll into the global assembly cache and adds a reference to count it. The scheme parameter, FILEPATH, and the id parameter, c:\applications\myApp\myApp.exe, specify the path to the application that is installing myDll.dll. The description parameter is specified as MyApp.

gacutil /i /r myDll.dll FILEPATH c:\applications\myApp\myApp.exe MyApp

The following command installs myDll.dll into the global assembly cache and adds a reference to count it. The scheme parameter, OPAQUE, allows you to customize the id and description parameters.

gacutil /i /r mydll.dll OPAQUE "Insert custom application details here" "Insert Custom description information here"

The following command removes the reference to myDll.dll by the application myApp. If this is the last reference to the assembly, it will also remove the assembly from the global assembly cache.

gacutil /u /r myDll.dll FILEPATH c:\applications\myApp\myApp.exe MyApp

The following command lists the contents of the global assembly cache.

gacutil /l

原文地址:https://www.cnblogs.com/MayGarden/p/1630866.html