views:

93

answers:

2

What exactly does the VS project option "Register for COM interop" actually do? Because when I build my library with this option enabled I can call CreateObject on my library from VBScript. But if I build without this and then run regasm manually CreateObject fails. So I'm wondering -- what does VS2010 do that I'm not doing?

A: 

According to MSDN:

The Register for COM interop project property specifies whether your managed application will expose a COM object (a COM-callable wrapper) that allows a COM object to interact with your managed application.

Justin Ethier
I understand this, but what commands does it run? When I run regasm my.dll /codebase /tlb:my.tlb I can't get CreatObject (in VBScript) to work against my library which is all I figured it did.
statichippo
+1  A: 

It does the same thing as running Regasm.exe with the /codebase option. Which is probably the option your forgot. Regasm likes assuming you put the DLL in the GAC. Which is a good way to avoid DLL Hell, always a COM problem, but not appropriate on your dev machine.

Using the wrong version of Regasm.exe on a 64-bit machine is another way to get in trouble.

Hans Passant
Thank you! I was using the /codebase option but it was apparently using the 64bit instead of 32bit version. Explicitly used 32bit version and worked like a charm.
statichippo

related questions