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.