Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / Interop / December 2004

Tip: Looking for answers? Try searching our database.

Deploy COM DLL to the GAC

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Ben Amada - 04 Dec 2004 08:56 GMT
Hi,

In VS.NET 2003, I've created a COM Interop project.  I have the DLL and TLB
file in the /bin directory.  I want to deploy this to the GAC of another
machine which has the .NET framework installed on it.  My questions are:

1. This might sound stupid, but where exactly is the GAC?

2. Do I need to copy both the DLL and TLB files to the GAC?

3. Do I need to run regasm if deploying to the GAC?

4. Do I need to create a strong name for the assembly if deploying to the
GAC?

Thanks in advance for any information,
Ben
Kaustav - 04 Dec 2004 12:35 GMT
Hi Ben,

1. This might sound stupid, but where exactly is the GAC?
GAC is present in "\WINDOWS\assembly" folder.

2. Do I need to copy both the DLL and TLB files to the GAC?
Nope, just the DLL is to be copied.

3. Do I need to run regasm if deploying to the GAC?
No you need not. Regasm is only required for COM Interop, ie if you need
your unmanaged applications to see and reference your managed Dll.

4. Do I need to create a strong name for the assembly if deploying to the
GAC?
Yes that is necessary.

HTH.

Kaustav Neogy.

> Hi,
>
[quoted text clipped - 13 lines]
> Thanks in advance for any information,
> Ben
Ben Amada - 04 Dec 2004 13:18 GMT
Hi Kaustav,

Please see comments inline ...

> Hi Ben,
>
> 1. This might sound stupid, but where exactly is the GAC?
> GAC is present in "\WINDOWS\assembly" folder.

Okay.

> 2. Do I need to copy both the DLL and TLB files to the GAC?
> Nope, just the DLL is to be copied.

Actually, I'm planning on using the managed DLL for COM Interop ... in this
case, do I need the TLB file as well as the DLL?

> 3. Do I need to run regasm if deploying to the GAC?
> No you need not. Regasm is only required for COM Interop, ie if you need
> your unmanaged applications to see and reference your managed Dll.

Yes, I need to use the managed DLL for COM Interop, so I guess I'll need to
run regasm.

> 4. Do I need to create a strong name for the assembly if deploying to the
> GAC?
> Yes that is necessary.

Can you provide any links or point me to some documentation that shows how
to create a strong name and/or how to add (or specify?) the strong name in
the assembly?  I've seen some posts talking about strong names, but for some
reason I'm somewhat confused on how to do this.

> HTH.

Yes, your reply has been very helpful  :-)

> Kaustav Neogy.

Thanks,
Ben
Kaustav - 04 Dec 2004 18:55 GMT
Hi Ben,

since you are trying to use COM Interop, I guess you should proceed as
mentioned below.

1. Create a new keypair file for strong naming your assembly. For this go to
a VS.NET Command Prompt and type the following:
sn -k C:\YourFilename.snk

This will create a new key-pair file.

2. Next step is to assign a strong name to the assembly. For this, open
AssemblyInfo.cs or AssemblyInfo.vb file whichever is applicable. Modify the
attribute [assembly: AssemblyKeyFile("")] to [assembly:
AssemblyKeyFile("C:\\YourFilename.snk")]
which you had created in step 1.

3. Now for all Public Classes in your assembly, add the following two
attributes: [ClassInterface(ClassInterfaceType.AutoDual)]
[GuidAttribute("GUID-VALUE")]

Note: Replace GUID-VALUE with a new GUID Value. You can get a new GUID Value
from VS.NET->Tools->Create GUID. Copy the GUID Value and replace it in the
attribute.

4. Compile your code.

5. Next run Regasm to register it for COM Interop.

6. Add the assembly to GAC.

HTH

Kaustav Neogy.

> Hi Kaustav,
>
[quoted text clipped - 37 lines]
> Thanks,
> Ben
Ben Amada - 05 Dec 2004 09:03 GMT
Hi Kaustav,

I ran into one small problem, but was able to figure it out.  Now, I'm
successfully able to use the managed DLL after following your instructions
:-)

Thanks very much!
Ben

> Hi Ben,
>
[quoted text clipped - 30 lines]
>
> Kaustav Neogy.

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.