How do I register a .NET COM DLL with Regsvr32?

You can’t. Managed [ComVisible] class libraries need to be registered with Regasm.exe.

You can do it from the IDE with Project + Properties, Build tab, Register for COM interop checkbox. If you run Regasm.exe you usually want the /codebase command line option so you don’t have to put the assembly in the GAC. Yet another option is to let Regasm.exe generate a .reg file with the /regfile option. You’d just run that on the target machine to get the registry updated.

Edit: just saw the “major problems” remark. Note sure what they are, short from /codebase. You do have to pick the right version on 64-bit machines. There are two. And you need an elevated command prompt so that UAC don’t put a stop to it.

Leave a Comment