Google Search

Google
 

Monday, February 11, 2008

GAC

1.Windows Installer
The preferred way to add/remove assemblies from the GAC is with Microsoft Windows Installer 2.0. Visual Studio includes a limited version of Windows Installer, and most major setup programs such as InstallShield also use Windows Installer. There are benefits to using Windows Installer:
•Windows Installer provides a simple interface for developers to add/remove shared assemblies in the GAC and can handle private assemblies as well.
•Installer provides a familiar interface and setup experience for the user.
•Installer can also install application shortcuts and supporting files such as ReadMe and license agreements and can run other installation programs and scripts.
•Installer registers and tracks references to assemblies installed in the GAC to determine which assemblies are still required.
•Installer can repair and patch assemblies and rollback unsuccessful installations.
•Installer can install assemblies on-demand as they are needed by applications.

GAC Utility
The .NET developer's kit includes a command line utility GACutil.exe to interact with the GAC. This utility is intended for use in a development environment only and should not be used to install assemblies on a client PC because:
• The GACutil license agreement states that it is not freely distributable.
• GACutil is part of the .NET SDK, which may not be installed on many target PCs.
• GACutil lacks many important features found in Windows Installer such as assembly repair and rollback.
Assembly Cache Viewer
Using the Assembly Cache Viewer shown above, you can drag & drop assemblies from any folder into the GAC and also delete assemblies installed in the GAC.
How do I access the GAC programmatically?
You can access the GAC from code with the fusion.dll library. Here is an excellent C# wrapper for the GAC.You are strongly advised NOT to access the GAC from code unless you are creating an administrative or setup tool. The Fusion APIs expose your application to the inner workings of assembly binding and may cause your application to fail on future .NET versions.
What is a strong name?
A strong name is a .NET assembly name combined with its version number and other information to uniquely identify the assembly. This allows multiple versions of the same assembly to peacefully co-exist in the global assembly cache, where shared assemblies are typically stored.
A strong name consists of five parts:
1. Simple Name - Usually the name of the file (without the extension) that contains the assembly
2. Public Key - RSA cryptographic public key that helps verify the assembly's authenticity
3. Version - Four-part version number, in the form of Major.Minor.Build.Revision
4. Culture - Target audience for the assembly, such as "neutral" (default audience), "en-us" (English - United States) or "fr" (France) etc.
5. Processor Architecture - Defines the assembly's format, such as MSIL (intermediate language) or x86 (binary for Intel x86 processors)

No comments: