Search Amazon:

Add/remove a shared assembly to/from the .NET GAC

Each computer that .NET is installed on has a Global Assembly Cache (GAC) located in the Assembly folder in the Windows directory (usually: C:\WinNT\Assembly). The GAC contains information about shared assemblies which are components that can be shared among several applications (Ex. a DLL).

Shared assemblies must have globally unique names derived from their strong names (public keys generated to distinguish assemblies from other assemblies that may have the same names) which is Microsoft's solution to DLL hell. The GAC, not the registry, is the store for this information. When an application loads the GAC is examined by the Common Language Runtime to determine if the version of a shared component exists that is compatible with the one referenced by the application.

The gacutil.exe that ships with .NET can be used to add or remove a shared assembly from the GAC.

To add a shared assembly, from the command line enter:

    gacutil.exe /i myassembly.dll

To remove a shared assembly, from the command line enter:

    gacutil.exe /u myassembly.dll

When viewing the GAC in Windows Explorer shfusion.dll is used to provide the user interface. You can locate and rename this DLL to view the GAC like any other folder.

To learn more about assemblies and the Global Assemblies Cache, click here.

Sign In
  User Id 
  Password 


Submit Your Own Code and Articles




About TheScarms
About TheScarms

Ask me your programming questions

I read every email and answer all I can.

User Feedback: Be the first to add a comment! Items to Show:     

     
You must log in to post feedback.
Comment:    
 

If you use this code, please mention "www.TheScarms.com"

Email this page


TheScarms AppSentinel lets you securely copy protect and create evaluation versions of your software

TheScarms(tm) AppSentinel lets you quickly and easily create evaluation versions of your software and stop unauthorized copying and unregistered use of your programs!

Get your free
trial copy today!


      The World's Number 1 Web Host

© Copyright 2008 TheScarms