• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 2120
  • Last Modified:

How to Publish an Assembly

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.
1 Solution

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.
averma78Author Commented:
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.
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

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


Edward JoellCommented:
Link in accepted solution does not work.
Edward JoellCommented:
and gacutil produces error  "gacutil" is not recognized as an internal or external command operatable program or batch file.

Featured Post

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now