How to Publish an Assembly

Posted on 2004-11-28
Last Modified: 2008-03-04
What are the steps for publishing an assembly. I know all about gacutil.exe, sn.exe, al.exe but i don't know how to use them to publish an assembly. Can someone explain me in detail and where is the GAC folder so that i can view all the assemblies.
Question by:averma78
    LVL 28

    Expert Comment


    install mylib.dll assembly in GAC
    gacutil /i mylib.dll

    gacutil /u mylib.dll

    Note that you pass the assembly name (not the file name)

    The potential problem with /u command that it removes every instance of mylib assembly, regardless
    of version number..To avoid it you should specify precisely what you want to remove
    gacutil -u mylib,ver1.2.00,loc=it,PublicKeyToken=44cd4ab12f0a88a1

    you can list all the shared assemblies in GAC  using:
    gacutil /l

    another way to install to GAC

    1. Make a Public module and put the functions in it.
    2. CD to your C:\Windows\Microsoft.NET\Framework\v1.1.4322 folder and type: sn -k c:\mykey.snk
    3. Add this to the top of your module:
    Imports System.Runtime.CompilerServices
    And before the Module:
    <assembly: AssemblyKeyFile("c:\mykey.key")>
    4. CD back to the v1.1.4322 folder and type this in: gacutil /i c:\project\myassembly.dll

    Make sure to replace paths with your actual directories.

    Now you can add a reference to the DLL anywhere on your computer without having to move the DLL

    On most systems, the Global Assembly Cache (GAC) is stored in the C:\Windows\Assembly\GAC folder.
    However, it is possible to move the GAC to another directory by creating a new value named
    CacheLocation under the HKEY_LOCAL_MACHINE\Software\Microsoft\Fusion registry key. Moving
    the GAC can be useful when testing installation routines or to make it point to a network share.

    Author Comment

    I have done this the problem is when i try gacutil /i c:\project\myassembly.dll it give me this Unknown Option: and and when i check gac there is no refrence of my assembly in gac. But if I drag and drop dll into gac it does add a refrence in gac but how to do it from command line.
    LVL 10

    Accepted Solution

    LVL 10

    Expert Comment

    the gacutil.exe is stored into ur hard drive at

    C:\Program Files\Microsoft Visual Studio .NET\FrameworkSDK\Bin


    so to use it from command line

    do this

    C:\>Program Files\Microsoft Visual Studio .NET\FrameworkSDK\Bin gacutil.exe

    try and let me know

    LVL 10

    Expert Comment



    Expert Comment

    by:Edward Joell
    Link in accepted solution does not work.

    Expert Comment

    by:Edward Joell
    and gacutil produces error  "gacutil" is not recognized as an internal or external command operatable program or batch file.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Highfive Gives IT Their Time Back

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
    It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
    Need more eyes on your posted question? Go ahead and follow the quick steps in this video to learn how to Request Attention to your question. *Log into your Experts Exchange account *Find the question you want to Request Attention for *Go to the e…
    In this sixth video of the Xpdf series, we discuss and demonstrate the PDFtoPNG utility, which converts a multi-page PDF file to separate color, grayscale, or monochrome PNG files, creating one PNG file for each page in the PDF. It does this via a c…

    779 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    11 Experts available now in Live!

    Get 1:1 Help Now