working with the GAC

I created a brand new vb.net 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 1.0.0.0 via the following change:
<Assembly: AssemblyVersion("1.0.0.0")>   '(change from 1.0.* to 1.0.0.0)

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)...is 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?
dhilwala2001Asked:
Who is Participating?
 
RobertRFreemanCommented:
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.
0
 
RobertRFreemanCommented:
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.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.