Install an assembly in global assembly cache - .NET Framework (2024)

  • Article

This article describes how to install an assembly .dll file in the Microsoft .NET Framework global assembly cache, and create an assembly that has a strong name by using Visual Studio.

Original product version: .NET Framework, Visual Studio
Original KB number: 910355

Summary

To install an assembly .dll file in the .NET Framework global assembly cache, you can use the .NET Framework SDK Global Assembly Cache tool. You can also use the Global Assembly Cache tool to verify that the assembly is installed in the global assembly cache. To accomplish this task, you may have Administrator rights to the computer where the shared assembly is installed. What's more, you must install the .NET Framework SDK.

For a Visual C# .NET version of this article, see How to install an assembly into the Global Assembly Cache in Visual C#.

Global assembly cache

The .NET Framework global assembly cache is a code cache. The global assembly cache is automatically installed on each computer that has the .NET Framework common language runtime installed. Any application that is installed on the computer can access the global assembly cache. The global assembly cache stores assemblies that are designated to be shared by several applications on the computer. Component assemblies are typically stored in the C:\WINNT\Assembly folder.

Note

Only install an assembly in the global assembly cache when you need to share the assembly. Unless sharing an assembly is explicitly required, we recommend you keep assembly dependencies private and that you locate the assembly in the application directory. Additionally, you don't have to install an assembly in the global assembly cache to make the assembly available to Microsoft Component Object Model (COM) interop or to un-managed code.

An assembly

An assembly is a fundamental part of programming with the .NET Framework. An assembly is a reusable, self-describing building block of a .NET Framework common language runtime application.

An assembly contains one or more code components that the common language runtime executes. All types and all resources in the same assembly form an individual version of the unit. The assembly manifest describes the version dependencies that you specify for any dependent assemblies. By using an assembly, you can specify version rules between different software components, and you can have those rules enforced at run time. An assembly supports side-by-side execution. WHich enables multiple versions to run at the same time.

Strong-name signing

An assembly must have a strong name to be installed in the global assembly cache. A strong name is a globally unique identity that can't be spoofed by someone else. By using a strong name, you prevent components that have the same name from conflicting with each other or from being used incorrectly by a calling application. Assembly signing associates a strong name together with an assembly. Assembly signing is also named strong-name signing. A strong name consists of the following information:

  • The simple text name of the assembly
  • The version number of the assembly
  • The culture information about the assembly, if this information is provided
  • A public key and private key pair

This information is stored in a key file. The key file is either a Personal Information Exchange (.pfx) file or a certificate from the current user's Microsoft Windows certificate store.

You can sign an assembly by using the options on the Signing tab of the Project Designer in Visual Studio. In Visual Studio, the key file must be stored in the project folder on the local computer. Visual Studio supports only the following file formats:

  • Personal Information Exchange (.pfx) files
  • Strong name key (.snk) files

Requirements

You might meet the following requirements before you install an assembly in the global assembly cache:

  • You must have Administrator rights to the computer where the shared assembly is installed.
  • You must install the .NET Framework SDK.

This article assumes that you're familiar with the following topics:

  • General familiarity with shared assemblies in .NET.
  • General familiarity with the use of tools at a command prompt.

Install an assembly in the global assembly cache

This method is based on how to create an assembly by using Visual Studio. To create an assembly that can be shared by multiple applications, the shared assembly must have a strong name. Additionally, the shared assembly must be deployed in the global assembly cache.

To create a small Visual C# assembly that has a strong name and to install the compiled .dll file in the global assembly cache, follow these steps:

  1. Create a new Visual C# Class Library project that is named GACDemo. To do it, follow these steps:

    1. Start Visual Studio.
    2. On the File menu, select New Project.
    3. In the Templates list, select Class Library.
    4. In the Name box, type GACDemo, and then select OK.
    5. To save the project, press CTRL+SHIFT+S.
    6. In the Location box, type C:\DemoProjects.
    7. Clear the Create directory for solution check box, and then select Save.
  2. Generate a strong name, and then associate the strong name key file together with the assembly. To do it, follow these steps:

    1. On the Project menu, select GACDemo Properties.

    2. On the Signing tab, select the Sign the assembly check box.

    3. Under Choose a strong name key file, select <New>.

    4. In the Create Strong Name Key dialog box, select the Protect my key file with a password check box.

    5. In the Key file name box, type GACDemo.

    6. In the Enter password box, type the password that you want to use.

    7. In the Confirm password box, type the same password, and then select OK.

      Note

      We recommend you always use a password when you create a key file. A new key file that is protected by a password is always created in the .pfx file format.

    8. To compile the project, press CTRL+SHIFT+B.

      Note

      No additional code is required to install a .dll file in the global assembly cache.

  3. Install the .dll file that you created in step 2 in the global assembly cache by using the Global Assembly Cache tool. To do it, follow these steps:

    1. Select Start, select Run, type cmd, and then select OK.
    2. Change the current working directory to the directory where the .NET Framework SDK is installed.
    3. At a command prompt, type the gacutil -I "C:\DemoProjects\GACDemo\bin\Release\GACDemo.dll" command, and then press ENTER.

Verify the assembly is installed in the global assembly cache

You can use the Global Assembly Cache tool to verify the assembly is installed in the global assembly cache. To do it, follow these steps:

  1. Select Start, select Run, type cmd, and then select OK.

  2. Change the current working directory to the directory where the .NET Framework SDK is installed.

  3. To display the installation information about the GACDemo assembly, use the Global Assembly Cache tool. To do it, type the gacutil -l GACDemo command at a command prompt, and then press ENTER.

    Note

    The installation information about the GACDemo assembly is displayed.

References

  • Assemblies Overview

  • Global Assembly Cache

  • Global Assembly Cache Tool (Gacutil.exe)

Install an assembly in global assembly cache - .NET Framework (2024)

FAQs

Install an assembly in global assembly cache - .NET Framework? ›

The Global Assembly Cache (GAC) is a central repository for storing shared assemblies. The GAC allows multiple versions of the same assembly to be installed concurrently and also prevents different assembly vendors from overwriting each other's assemblies.

Can assemblies be stored in global assembly cache? ›

The Global Assembly Cache (GAC) is a central repository for storing shared assemblies. The GAC allows multiple versions of the same assembly to be installed concurrently and also prevents different assembly vendors from overwriting each other's assemblies.

How to install global assembly cache? ›

How to install or register an assembly in GAC
  1. Click Start > All Programs > Administrative Tools > Microsoft . NET Framework 2.0/4.0 Configuration.
  2. Click Manage the Assembly Cache.
  3. Select Add an Assembly to the Assembly Cache.
  4. Browse and select your DLL, which you want to install it in GAC.
  5. Click Open. ...
  6. Restart the IIS.
Mar 20, 2014

How to add dlls to GAC? ›

Method 2:
  1. Go to Control Panel -> Administrative tools -> Microsoft . NET Framework 1.1 Configuration.
  2. click on “Manage the Assembly Cache”.
  3. click “Add an Assembly to the Assembly Cache”.
  4. Select the dll to install assembly and same wizard can be used to remove the assembly.
Aug 12, 2010

How to check if assembly is installed in GAC? ›

To get information on the the assembly attributes (Version, Culture, PublicKeyToken), run the gacutil /l command which will return a list of all the assemblies in the GAC. You can also see the information associated with a particular assembly using the -l parameter. For example: gacutil -l TelerikCommon*

Why use global assembly cache? ›

The Global Assembly Cache stores 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.

Where are .NET assemblies stored? ›

For most . NET Framework applications, you locate assemblies that make up an application in the application's directory, in a subdirectory of the application's directory, or in the global assembly cache (if the assembly is shared).

Where are GAC files located? ›

The GAC is located in the following folder: C:\Windows\Microsoft.NET\assembly\GAC_MSIL.

How do I enable global cache? ›

By default, the global cache is turned off, and the cache policy is set to disabled. To use the global cache, select an integration node-level cache policy by using the cachePolicy parameter. The global cache has a default single-integration node topology that can be used immediately without any configuration.

Where is the Gacutil DLL located? ›

The Gacutil.exe tool is located in the . NET Framework installation directory. The default location for this is C:\Program Files (x86)\Microsoft SDKs\Windows\v10. 0A\bin\NETFX 4.6.

How do I reference GAC assembly in Visual Studio? ›

NET Framework assembly:
  1. Open the windows Run dialog (Windows Key + r)
  2. Type C:\Windows\assembly\gac_msil. ...
  3. Find your assembly and copy its path from the address bar.
  4. Open the Add Reference dialog in Visual Studio and choose the Browse tab.
  5. Paste in the path to your GAC assembly.
Jan 14, 2009

How do I download a DLL from GAC? ›

Get DLL Out of The GAC
  1. Run regsvr32 /u C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\shfusion.dll. ...
  2. Open “%windir%\assembly\GAC_MSIL”.
  3. Browse to your DLL folder into the deep to find your DLL.
  4. Copy the DLL somewhere on your hard disk and refer it from there in your project.
  5. Run "regsvr32 %windir%\Microsoft.NET\Framework\<.
Apr 3, 2009

How to run gacutil in cmd? ›

You can run GACUtil using the Visual Studio Command Prompt. The Visual Studio Command Prompt is automatically installed with Visual Studio. To run the tool, use the Developer Command Prompt (or the Visual Studio Command Prompt in Windows 7). For more information, see Visual Studio Command Prompt.

What is GAC how and when to install an assembly into GAC? ›

GAC stands for Global Assembly Cache and it contains only the Strong Named Assemblies. Each computer where the Common Language Runtime is installed has a machine-wide code cache called the Global Assembly Cache. An assembly is said to be strongly named when it contains the following properties.

How to clear Global Assembly Cache? ›

Removing the assembly from GAC
  1. Start the . ...
  2. Select Assembly Cache from the tree view on the left.
  3. Click the View List of Assemblies in the Assembly Cache link.
  4. Find Sybase. ...
  5. Select one or more assemblies to remove. ...
  6. Check for the publisher policy files that correspond to the versions removed and remove these files too.

Which assemblies can be stored in GAC? ›

Assemblies that should be used by applications can be put in the global assembly cache. For example, if all applications should use an assembly located in the global assembly cache, a version policy statement can be added to the Machine. config file that redirects references to the assembly. File security.

Where are CLR assemblies stored? ›

Assembly information is stored in the sys. assembly_files table in the database where the assembly has been installed. The sys. assembly_files table contains the following columns.

Where are assembly instruction stored? ›

Assembler doesn't send instructions to CPU, it prepares such content of memory (machine code), and usually it is stored into file on storage device, for later usage (execution).

Where are shared assemblies stored? ›

A shared assembly is an assembly that resides in a centralized location known as the GAC (Global Assembly Cache) and that provides resources to multiple applications. If an assembly is shared then multiple copies will not be created even when used by multiple applications. The GAC folder is under the Windows folder.

Where are global variables stored in assembly? ›

Static Data holds global variables. The Stack holds procedure activation records and the Heap dynamic data. Global Variables are stored in the Static Data area. Strings (such as "Bart!") are stored in the Initialized Data section.

Top Articles
Great Recession: Definition, Causes, and Effects | The Motley Fool
Medical X-ray Imaging | FDA
Hometown Pizza Sheridan Menu
Antisis City/Antisis City Gym
Warren Ohio Craigslist
Uhauldealer.com Login Page
Palm Coast Permits Online
Hocus Pocus Showtimes Near Harkins Theatres Yuma Palms 14
Sportsman Warehouse Cda
Aiken County government, school officials promote penny tax in North Augusta
United Dual Complete Providers
13 The Musical Common Sense Media
Regular Clear vs Low Iron Glass for Shower Doors
The Connecticut Daily Lottery Hub
Gfs Rivergate
Rosemary Beach, Panama City Beach, FL Real Estate & Homes for Sale | realtor.com®
Lake Nockamixon Fishing Report
Define Percosivism
50 Shades Darker Movie 123Movies
Scotchlas Funeral Home Obituaries
What Is Vioc On Credit Card Statement
Juicy Deal D-Art
Riherds Ky Scoreboard
Boston Dynamics’ new humanoid moves like no robot you’ve ever seen
Coomeet Premium Mod Apk For Pc
Thick Ebony Trans
Www Va Lottery Com Result
Wisconsin Volleyball Team Boobs Uncensored
Bòlèt Florida Midi 30
Inbanithi Age
TeamNet | Agilio Software
Gopher Hockey Forum
1964 Impala For Sale Craigslist
Wells Fargo Bank Florida Locations
Luciipurrrr_
Kstate Qualtrics
T&J Agnes Theaters
Can You Buy Pedialyte On Food Stamps
Ksu Sturgis Library
Stanley Steemer Johnson City Tn
Best Restaurants Minocqua
Gravel Racing
Rush Copley Swim Lessons
Memberweb Bw
Celsius Claims Agent
Child care centers take steps to avoid COVID-19 shutdowns; some require masks for kids
Jammiah Broomfield Ig
Petfinder Quiz
Sinai Sdn 2023
CPM Homework Help
Ssss Steakhouse Menu
Ingersoll Greenwood Funeral Home Obituaries
Latest Posts
Article information

Author: Golda Nolan II

Last Updated:

Views: 5655

Rating: 4.8 / 5 (78 voted)

Reviews: 85% of readers found this page helpful

Author information

Name: Golda Nolan II

Birthday: 1998-05-14

Address: Suite 369 9754 Roberts Pines, West Benitaburgh, NM 69180-7958

Phone: +522993866487

Job: Sales Executive

Hobby: Worldbuilding, Shopping, Quilting, Cooking, Homebrewing, Leather crafting, Pet

Introduction: My name is Golda Nolan II, I am a thoughtful, clever, cute, jolly, brave, powerful, splendid person who loves writing and wants to share my knowledge and understanding with you.