Wednesday, January 5, 2011

How to install assembly in GAC

Hi friends,

Follow following steps to install assembly in GAC (Global assembly cache) using C# VS 2005/2008 .


  1. In Visual Studio, create a new Visual C# Class Library project, and name the project TestGAC.
  2. To install assembly in GAC, assembly should be strong name. We use SN tool to generate cryptographic key pair. This tool is located in the \bin subdirectory where the .NET Framework Solution Developer Kit (SDK) is installed. Or eaiser way is:
    • In Solution Explorer, right-click GACDemo, and then click Properties.
    • Click the Signing tab, and then click to select the Sign the assembly check box.
    • In the Choose a strong name key list, click .
    • Type Mykey.snk
    • Compile the project.
3.Now you can install your assembly using Gacutil tool.

Ex: gacutil -I "[DriveLetter]:\[PathToBinDirectoryInVSProject]\TestGAC.dll"



That's it.Your assembly is in GAC....

Keep smiling..
Keep programming...

Mahesh Bagul
 
  1. http://support.microsoft.com/kb/815808
  2. http://support.microsoft.com/kb/315682

( Mahesh Bagul )
 Sr. Software Eng. Pune, India.

useful Links:

1 comment: