NET COM interop on CL 
Author Message
 NET COM interop on CL

I am trying to use a .NET dll from a COM environment.  I think I have almost
made it, but one step is failing.  I am doing most of this on the command
line, since I am using VB.NET STANDARD, which does not let you compile
libraries, and doesn't have any options for strong names etc.

OK, here's what I've done so far:

1. Create a .vb file (in VB.NET Standard) that contains an interface, and
one class that implements that interface
2. compile on the command line into a .dll file
3. use regasm to create a type library
4. use gacutil to to add assembly to GAC

The first two steps are succesful, and the class shows up in a .NET
environment.
The third step is also successful.
The last step fails because the assembly does not use strong names.

Can anyone tell me how to implement strong names on the CL (I can't do it in
the VS IDE)?
I have the CL syntax, and have tried adding a .snk file to the project, then
redo steps 1 thru 4, but that didn't to work.

Any help is greatly appreciated.

Thanks.

Rino



Tue, 28 Dec 2004 23:02:10 GMT  
 NET COM interop on CL
Rino,

Quote:
>Can anyone tell me how to implement strong names on the CL (I can't do it in
>the VS IDE)?

It's done in the same way regardless if you're using VS.NET or the
command line compiler. Use the AssemblyKeyFile attribute in code to
point to your .snk file.

Mattias

===
Mattias Sj?gren (VB MVP)

http://www.msjogren.net/dotnet/



Wed, 29 Dec 2004 00:04:23 GMT  
 NET COM interop on CL
Mattias:

Thanks for your suggestion.

I assume you mean referencing the.snk file in the assemblyinfo.vb file?  I
have included the reference (uing the full path to the file), but still get
the same error when executing step 4: 'Failure adding assembly to the cache:
Attempt to install an assembly without a strong name'

Thanks.

Rino


Quote:
> Rino,

> >Can anyone tell me how to implement strong names on the CL (I can't do it
in
> >the VS IDE)?

> It's done in the same way regardless if you're using VS.NET or the
> command line compiler. Use the AssemblyKeyFile attribute in code to
> point to your .snk file.

> Mattias

> ===
> Mattias Sj?gren (VB MVP)

> http://www.msjogren.net/dotnet/



Wed, 29 Dec 2004 01:02:39 GMT  
 NET COM interop on CL
Rino,

Quote:
>I assume you mean referencing the.snk file in the assemblyinfo.vb file?

Any source file will do, AssemblyInfo is just the convention used by
VS.NET.

Quote:
>I
>have included the reference (uing the full path to the file), but still get
>the same error when executing step 4: 'Failure adding assembly to the cache:
>Attempt to install an assembly without a strong name'

That's strange. Did it compile correctly? What happend if you execute

sn -T YourAssembly.dll

from the command line?

Mattias

===
Mattias Sj?gren (VB MVP)



Wed, 29 Dec 2004 06:23:12 GMT  
 NET COM interop on CL
Mattias:

I solved the last problem I described.  I now perform these steps:

1. Create a .vb file (in VB.NET Standard) that contains an interface, and
one class that implements that interface
2. Create a .snk file using the sn.exe, save it in project directory
3. compile on the command line (vbc.exe) into a .dll file, referencing the
.snk file (/keyfile:...)
 4. use regasm to create a type library
5. use gacutil to to add assembly to GAC

All steps complete successfully.

I then open up Excel (VBA), and reference the COM/tlb file in the project
references. Although the class contained in the DLL shows up in the object
browser, and it shows the appropriate methods and propertied of the class, I
can't create an object from the class.

Since VBA didn't give a very descriptive error message, I then tried the
same in VB6, and it returned an error about the CLSID: "No server
registered, or could not load class for CLSID"

HELP!

Thanks.

Rino


Quote:
> Rino,

> >I assume you mean referencing the.snk file in the assemblyinfo.vb file?

> Any source file will do, AssemblyInfo is just the convention used by
> VS.NET.

> >I
> >have included the reference (uing the full path to the file), but still
get
> >the same error when executing step 4: 'Failure adding assembly to the
cache:
> >Attempt to install an assembly without a strong name'

> That's strange. Did it compile correctly? What happend if you execute

> sn -T YourAssembly.dll

> from the command line?

> Mattias

> ===
> Mattias Sj?gren (VB MVP)



Fri, 31 Dec 2004 22:45:24 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. Automation error referencing .net dll from com (com interop)

2. Severe VB.NET COM/.NET Interop Limitation

3. COM / .NET interop

4. VB.NET COM Interop -vs- VB6 ---- The Turtle And The Hare

5. .Net browser control wrapper...will there be one?, com interop is crap

6. .NET to COM Interop with VSS - Deployment Question

7. .net interop with COM

8. Problem passing VB COM+ ASP Request object to .NET component System.Web.HTTPRequest through COM interop

9. COM Interop - using .NET component in VC6 client app

10. Unregisterable COM/AciveX DLL - Interop in VS.NET

11. VB.NET COM interop debugging

12. Microsoft: PLEASE ADDRESS THIS (VB.NET COM Interop)

 

 
Powered by phpBB® Forum Software