Installing to GAC using Deployment Project

G

Guest

Hi,

I have written an App in vb.Net (2003) which references Excel 2000. This
creates a Interop_Excel.dll which I need to reference in my project. All OK
so far.
I had to modify the Interop_Excel.dll and renamed it tm_Interop_Excel.dll
after modification. This new dll has a strong name and all the correct
attributes.

If I create a deployment project for my app, the tm_Interop_excel.dll is
placed in my application folder.

However I need this dll to be installed in the GAC. I can do this manullay
using GACUTIL, and all is OK.

When I create an installer, using VS 2003, I drag the dll form my
application folder into the Global assembly folder. (file system on target
machine).

When the installer is run, the tm_Interop_Excel.dll is placed into the GAC
but without a codebase entry and my app does not work. If I then run the
GACUTIL -i the codebase entry is added and all is ok.

I have found the GACUTIL is missing on some target computers so I cannot
relie on it being there.

So my question is, How do I create an installer which will automatically
place my tm_Interop_Excel.dll into the GAC correctly without using the
GACUTIL.exe.

Thanks in advance
 
P

Phil Wilson

You're doing the right thing, but where is this codebase value you are
referring too? Codebase is usually referred to in the context of Regasm.exe
or a config file. Gacutil just puts assemblies in the GAC, like the
deployment project does.
 
T

Tim Marsden

Phil,
Many thanks for the swift reply.

When I use the GACUTIL, then find the entry in he GAC, right click and
look at properties, the is an entry for Codebase, which references the
location of the dll I installed using the GACUTIL.

If I check the GAC after I use the installer there is no entry for the
codebase on the dll's properties.

Do I need to do anything special because it is a interop dll?

Regards
Tim
 
S

Sebastian Wain

Hi Tim,

If you need to mimic the process of 'gacutil' and/or 'regasm' because
they may be not in the target machine, you can use:


[C#]
using System.EnterpriseServices.Internal;
....
Publish p = new Publish();
// for GAC Installation
p.GacInstall(file); // for gac installation
....
p.GacRemove(file); // for gac removing
....
p.RegisterAssembly(file); // for registering assembly for interop
....
p.UnRegisterAssembly(file); // to unregister assembly
[/C#]


Regards,
Sebastian Wain
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top