views:

719

answers:

4

What is the best way to do a .NET COM DLL Deployment, I'm having problems using it in the client machine. The COM is being used in a VB6 app.I can add a reference, but when I try to use create objects it gives me an Automation Error.

Thanks in advance.

+1  A: 

Check out these steps.

I followed these and I also had to Strong Name my assembly, and register it with the /codebase command line option before it would work.

TlbExp may also be necessary to generate a COM proxy.

Heres another link that may help with some of the limitations.

If I recall some other key points

  • you could not have a parameterized constructor
  • no static or shared members
  • little to no inheritance (dont use shadowed or other derived functionality)
  • Set an assembly attribute of Com Accessible = True
StingyJack
It also helps to add the assembly to the GAC on the target machine.
JohnFx
You don't need to add it to the GAC if you use strong-naming and the codebase switch.
Brent Rockwood
A: 

Can I confirm: you are writing a COM dll in .NET, that you want to consume from VB6?

The most supportable option would probably be to use an msi (setup and deployment package) to register the assembly with COM. You can do it at the command line, but it is harder.

Marc Gravell
A: 

You can do it at the command line using regasm using the /codebase switch as mentioned elsewhere. However if you're going to do any kind of wide distribution, I highly recommend using an MSI (also mentioned elsewhere). In that case, I highly recommend ignoring the COM self-registration and manually adding the registry keys manually to your MSI. It rolls back much more safely. If you use WiX to build your MSI, they have a tool (Heat) which will generate the WiX registry code for you.

Brent Rockwood
+2  A: 

You could check the answers to This Duplicate Question which, oh... you asked a day or two ago.

mackenir