F.2 Shared assemblies and the GAC


.NET assemblies can be categorized into two groups:

  • shared “ common libraries which are used by more than one .NET application;

  • stand-alone “ assemblies used by only one particular .NET application.

The global assembly cache (GAC) is where global shared assemblies are placed. Treat it like a normal folder (or directory) in a shared server from which client machines can retrieve shared assemblies in a distributed environment. You can view the contents of your local machine's GAC using Windows Explorer (go to c:\winnt\assembly “ if c:\winnt is where your Windows operating system is installed).

The assembly cache viewer [1] is installed together with the .NET framework. When you view your GAC using Windows Explorer, the assembly cache viewer kicks in automatically and, instead of the usual file attributes, you will see columns pertaining to assemblies such as type, version, and public key token “ see Figure F.1.

[1] The assembly cache viewer is actually the file shfusion.dll .

Figure F.1. Viewing the GAC using Windows Explorer.

graphics/ffig01.jpg

There is a useful command line tool called gacutil.exe that you can use to perform tasks such as:

  • store an assembly to the GAC (use the -i option);

  • remove an assembly from the GAC (use the -u option);

  • list the contents of the GAC (use the -l option). [2]

    [2] It is probably preferable and friendlier to view the GAC contents using Windows Explorer rather than gacutil .



From Java to C#. A Developers Guide
From Java to C#: A Developers Guide
ISBN: 0321136225
EAN: 2147483647
Year: 2003
Pages: 221
Authors: Heng Ngee Mok

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net