How to register a .dll in gac


  • I want to register a .dll in gac.plz help me to solve out.


    plz tell me what is process to register a .dll in through programming.

    • Moved by Andrew.Wu Tuesday, March 22, 2011 10:10 AM (From:.NET Framework Setup)
    Monday, March 21, 2011 9:11 AM


All replies

  • As your question is related to Visual Basic programming, and not .NET Framework setup/installation (this forum's topic), please ask in the Visual Basic developer forums, found here:

    Monday, March 21, 2011 12:42 PM
  • Hi Arkyadeep,

    I'm going to move your post to the Common Language Runtime Forum, you can get more efficient response to the CLR issues in that forum.

    Thanks for your understanding.

    Best Regards,

    Andrew Wu [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Tuesday, March 22, 2011 10:09 AM
  • To place a dll into the GAC the following steps need to be done:

    1. Generating a public key or a strong name

    go to VisualStudio.Net command prompt and type the following command:

    sn -k keyfile1.snk
    Here keyfile1.snk is the keyfile we are generating.

    You can store this key file in the bin folder of the assembly. In order to do this u have to go to the bin folder.

    For example:
    C:\foldername\assemblyname\bin sn-k keyfile1.snk

    By doing this the keyfile is stored in the bin folder.

    2. Adding the public key to the AssemblyInfo.vb file of the DLL. This step is called Signing the Assembly with a public key.

    Go to AssemblyInfo.vb file:
    <Assembly: AssemblyKeyFile("C:\foldername\assemblyname\\keyfile1.snk")> 

    3. Build the assembly

    4. Placing the dll into GAC .

    By using the utility gacutil -i (you should give the complete path of the dll)
    c:\>gactutil -i c:\foldername\assemblyname\bin\assemblyname.dll

    More about gacutil tool:

    • Proposed as answer by Maverikd Tuesday, March 22, 2011 10:42 AM
    Tuesday, March 22, 2011 10:33 AM
  • i want to do this trough coding automatically in
    Tuesday, March 22, 2011 10:37 AM
  • Hello Arkyadeep,

    >> i want to do this trough coding automatically in

    Answer found here :


    - Bio.


    • Marked as answer by Paul Zhou Tuesday, March 29, 2011 4:41 AM
    Tuesday, March 22, 2011 11:39 AM

    • You can install the .dll file by using the Gacutil tool or by dragging the .dll file to the appropriate folder. If you use the Gacutil tool, you can use a command that resembles the following:
      gacutil -I "[DriveLetter]:\[PathToBinDirectoryInVSProject]\gac.dll"
      To drag the file, open two instances of Windows Explorer. In one instance, find the location of the .dll file output for your console project. In the other instance, find c:\[SystemRoot]\Assembly. Then, drag your .dll file to the Assembly folder.
    Tuesday, April 24, 2012 2:46 PM
  • Monday, March 24, 2014 10:40 AM