You must Sign In to post a response.
  • Category: .NET

    How do I register an DLL in GAC

    The forum thread has not been reviewed by Editors yet. Readers are advised to use their best judgement before accessing this thread.
    This thread will be reviewed shortly.
    If you think this thread contain inappropriate content, please report to webmaster.
    Hi Friends,
    I have created an DLL & how do I register that DLL into GAC so that all my applns in my machine.

    Vipul Mehta
  • #23880
    Review This Steps

    Cheers !!!

    Abhay Lakkad

  • #23918
    The link that Abhay has given is good. But I would like to add something to that:

    To place a dll into the GAC the following steps need to be done:

    1. Generating a public key or a strong name
    2. Adding the public key to the AssemblyInfo.vb file of the DLL. This step is called Signing the Assembly with a public key.
    3. Build the assembly
    4. Placing the dll into GAC .

    1. Generating the public key:
    As Abhay said, 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. Placing the keyfile into the Assembly.
    Go to AssemblyInfo.vb file:
    <Assembly: AssemblyKeyFile("C:\foldername\assemblyname\\keyfile1.snk")>
    3. Build the Assembly.

    4. Placing the assembly into GAC

    There are two way in which u can place the assembly into GAC.
    1. Using the utility gacutil -i
    Here you should give the complete path of the dll

    c:\>gactutil -i c:\foldername\assemblyname\bin\assemblyname.dll

    2. The second method is u can drag the .dll file from the bin folder of the assembly and drop it into the folder C:\winnt\Assembly

    Doing this is same ie placing assembly into GAC.

    Good Luck.

  • This thread is locked for new responses. Please post your comments and questions as a separate thread.
    If required, refer to the URL of this page in your new post.