Powered by Blogger.

Sunday, February 16, 2014

GAC in Asp.Net

In this post we will discuss about what is GAC in .Net. Also you can check out my previous post on ExecuteNonQuery(), ExecuteReader() and ExecuteScalar() in Ado.Net, Anonymous Types in C#.Net and WCF interview questions and answers in C#.Net.

- GAC stands for Global Assembly Cache.

- GAC can be termed as registry of .Net framework for maintaining shared assemblies. This comes with .Net installation.

- Location of GAC is C:\Windows\assembly

- The GAC folder is accessible with security options-

1. The folder will only accept strong name assemblies.
2. The folder is accessible to the user with administrative previlages for placing  assembly or removing assembly.

- You can place an assembly into GAC in two ways:

1. Drag and Drop: Through explorer view you can drag and drop the assembly to the GAC.

2. GACUtil.exe: You can put assembly to GAC using the command line utility GACUtil.exe

Gacutil -i "Path of the assembly"

It will put the dll into GAC.

- To remove an assembly from GAC you can use the same GACUtil utility like below:

Gacutil -u AssemblyName

The above command will remove the assembly from GAC.

- Windows registry will maintain location of COM components where as GAC will contain assembly.

- Windows registry can not contain multiple versions of COM component where as GAC can contain multiple versions of assembly.