working with the GAC

Posted on 2005-04-25
Last Modified: 2006-11-18
I created a brand new class library project and called it, "MyNewClassLib"

I set the root name-space to "MNCL"

I created c:\mykey.snk via "sn -k c:\mykey2.snk" at the dos command prompt.

Then, I added the following tag after the assembly GUID tag in the AssemblyInfo.vb file:

<Assembly: AssemblyKeyFile("C:\mykey2.snk")>

I changed the assmbly version to via the following change:
<Assembly: AssemblyVersion("")>   '(change from 1.0.* to

I added a line of code to my Class1, just so that my class library has some meat in it...The complete Class1 code is shown below:
Public Class Class1
    Public x As Integer

End Class

I compiled the project.

Then I use the gac util to register my .dll into the gac.  Go to the proper directory where the newly created .dll resides then type the following:

gacutil /i MyNewClassLib.dll

The assembly gets added to the cache, so it says.

Now go to windows explorer, and
browse out to "C:\Windows\assembly"

If you look at the list, I do see "MyClassLib"
I do not see MCLB.MyClassLib

I thought this was strange, as I thought I would see the naumespace.project-name for some reason.  There are other listings in the Gac where one does see a period within the Global Assembly Name....

So that's the first question (above) to give some clarity on this matter.

The second question is this:  now that I got this in the GAC, and I also added the .dll to the required folder which allowed the .dll to be available in the Project / References box.

Supposing that I use this .dll in some new project, and supposing I create a distribution project (installation project / setup project).

When I burn a CD using the output from the setup project, does it automatically add the .dll to the GAC of the target machine?
Question by:dhilwala2001
    LVL 16

    Accepted Solution

    1st question.  These assemblies are named that way manually.  It is a standard convention to name your dll exactly the same as the top level namespace.

    2nd question.  No. You have to configure that in the setup project.  It will automatically add the dll to the project folder and it will use the version in the Project/References box, not the one in the GAC.
    LVL 16

    Expert Comment

    It doesn't benefit you to specify a dll in the GAC on your development computer or use the gacutil unless you are doing something on the client machine that the installer can't handle.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Enabling OSINT in Activity Based Intelligence

    Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

    I think the Typed DataTable and Typed DataSet are very good options when working with data, but I don't like auto-generated code. First, I create an Abstract Class for my DataTables Common Code.  This class Inherits from DataTable. Also, it can …
    Introduction As chip makers focus on adding processor cores over increasing clock speed, developers need to utilize the features of modern CPUs.  One of the ways we can do this is by implementing parallel algorithms in our software.   One recent…
    Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
    Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

    759 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

    10 Experts available now in Live!

    Get 1:1 Help Now