1
votes

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?

4

4 Answers

2
votes

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])

1
votes

Use RegAsm with siwtch /codebase if your assembly is not installed in the GAC (Global Assembly Cache).

Details of further switches is here

1
votes

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