Class not registered error for Instantiation of C# object via COM from VC++

会有一股神秘感。 提交于 2019-12-03 06:27:18

I've had that problem in the past and it was due to both processes not being 32 or 64 bit. If you are running a 32-bit OS, you can stop reading now because what I say doesn't apply.

Use regedit to try and find your ProgIds and CLSIDs in the registry. If your C++ project is 32-bit, make sure that your C# classes were registered to the 32-bit hive--HKEY_CLASSES_ROOT\Wow6432Node. If your C++ project is 64-bit, make sure that your C# classes were registered to the 64-bit hive--HKEY_CLASSES_ROOT.

If you need to register to the 64-bit hive, you may need to call the version of RegAsm.exe under c:\windows\microsoft.net\framework64...

The other possibility for things to go wrong is that you might need to run the .NET 4.0 version of regasm.exe. If you just type "regasm" in the command line, it will give you the version of regasm you are running. You might need to type the full path of .NET 4.0 version of regasm--found at c:\windows\microsoft.net\framework\v4.0.3019\regasm.exe.

Have you tried the /tlb option? Try that, and then

#import "your_tlb_file_lol.tlb" no_namespace

I think the other option might be to gac the assembly and then regasm it.

Try to leave your project in 32 bits because you know your project, creating in Any CPU an active component that runs at 32 with a registry error, so change the build to 32 or preferably to 32.

You Too register you dll with regsvr32

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!