How to put Assembly In GAC
In this, post we will see how to put assembly into GAC or Global assembly cache. Here we will also see how to use
GACUTIL and .net command prompts
To add assembly into GAC we need sign the assembly with strong name.
You can get the Key pair by opening .Net command prompt and execute SN -k c:\xxxxx.snk
Now, copy the file xxx.snk generated by tool and paste it into your class library project.
Setting environment for using Microsoft Visual Studio 2005 x64 cross tools.
c:\Program Files\Microsoft Visual Studio 8\VC>sn -k c:\xxx.snk
Microsoft (R) .NET Framework Strong Name Utility Version 2.0.50727.42
Copyright (c) Microsoft Corporation. All rights reserved.
Key pair written to c:\xxx.snk
c:\Program Files\Microsoft Visual Studio 8\VC>
open the assemblyinfo file give the path of newly created strongname keypair as shown in below example.
Compile the project. Now, your assembly is ready to get into GAC.
add below line
Save your assemblyinfo.cs file.
Compile the project.
Now, we will register assembly in gac.
Open your .Net command prompt
Use GACUtil -i to install the assembly into gac
c:\Program Files\Microsoft Visual Studio 8\VC>gacutil -i path_Of_your_signed_assembly.
You can find the assembly under Debug or Release folder of your BIN folder.
Now, your all applications can refer this shared assembly.
You can also browse GAC location using technique shown here: http://www.revenmerchantservices.com/ajax/systemwebextensions.html