articles

Home / DeveloperSection / Articles / GAC in .NET

GAC in .NET

AVADHESH PATEL6290 09-Jul-2012

Each computer where the common language runtime is installed has a machine-wide code cache called the global assembly cache. The global assembly cache stores .net assemblies specifically designated to be shared by several applications on the computer.

You should share assemblies by installing them into the global assembly cache only when you need to. As a general guideline, keep assembly dependencies private, and locate assemblies in the application directory unless sharing an assembly is explicitly required. In addition, it is not necessary to install assemblies into the global assembly cache to make them accessible to COM interop or unmanaged code.

You should share assemblies by installing them into the global assembly cache only when you need to. As a general guideline, keep assembly dependencies private, and locate assemblies in the application directory unless sharing an assembly is explicitly required. In addition, it is not necessary to install assemblies into the global assembly cache to make them accessible to COM interop or unmanaged code.

GAC in .NET

Use of GAC

Making two folder namely “service” and “consumer”

GAC in .NET

“show.cs” file save in “service” folder and “check.cs” file save in “consumer” folder

GAC in .NET

GAC in .NET

D:\ service>csc /t:library show.cs

ð  Show.dll is created

GAC in .NET

D:\consumer>csc /r:d:service\show.dll check.cs

D:\consumer>check.exe is created

GAC in .NET

D:\consumer>check

GAC in .NET

Authentication problem occurs

GAC in .NET

In the above snapshoot check.exe file not execute due to authentication problem. For solving this, make strong name and attached with cs file and then make dll. Mapped dll in assembly folder (C:\Windows\Assembly), with the help of gacutil command. This process called shared assembly.


Updated 07-Sep-2019
Avadhesh Kumar Patel District Project Manager - Aligarh 14 months work experience in Panchayati Raj Department Sector as District Project Manager & 12 months work experience in IT Sector as Software Engineer. :-)

Leave Comment

Comments

Liked By