1

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 Answers 4

2

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

Sign up to request clarification or add additional context in comments.

1 Comment

It must already be ComVisible if it works on Dev machine, +1 for regasm
1

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

Details of further switches is here

Comments

1

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

Comments

0

Use the Assembly Registration Tool (Regasm.exe)

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.