I have developed a C# com component which I am using from managed c++. On my dev machine when everything works fine. However when I distribute the files, I received an error that the component has not been registered. When I try a regsvr32 on the dll it gives me an error (C# dlls cannot be registered). How do I properly register this COM dll?
+2
A:
You use regasm with /codebase
(and it needs to be ComVisible [but as Patrick McDonald correctly poinhts out, you've already got past that as it works locally])
Ruben Bartelink
2009-08-05 10:54:41
It must already be ComVisible if it works on Dev machine, +1 for regasm
Patrick McDonald
2009-08-05 10:56:00
A:
Use RegAsm with siwtch /codebase
if your assembly is not installed in the GAC (Global Assembly Cache).
Aamir
2009-08-05 10:57:28
A:
I find that you normally need to do:
regasm /codebase
Because COM needs to know the exact location of your assembly to be able to load it.
As others have suggested, you will need to set you C# project as COM visible (project settings, application, assembly information button).
Finer control of which classes are visible or not can be obtained using the [ComVisible(true)] / [ComVisible(false)] attribute before each class
John Sibly
2009-08-05 11:00:31