R – Class Not Registered…. when trying to call a managed C# library from unmanaged C++

importinteropmanagedunmanaged

I have a C# library that I am using for a COM object in unmanaged C++ code. I registered the library using Visual Studio's checkbox "Register For Com Interop" and set ComVisible to true.

imported the tlb to the C++ app….. when I run it, I get a "Class Not Registered"….

This has worked before, but this started happening after I moved the directory of my C# project to a different location…. yes I did re-register the library after I moved it.

I've removed all references from the registry… I 've even tried doing a gacutil.exe /i on it… no dice.

Anyone know how to fix this?

Best Answer

A better way of using unmanaged objects in managed code is to use C++ / CLI. You can easily create a managed wrapper around the native object.

Related Topic