Migration of .NET COM object to 64 bit
We have C++ application which uses several COM object. COM object are .NET based (using COM Interop).
I need to migrate application to 64 bit. I specifically need C++ application to be 64 bit. I don't want to recompile all of .NET com object to 64 bit and deliver two sets of DLL's (32 bit and 64 bit).
I was investigating and found that I can load 32 bit COM Dll's in 32 bit surrogate process using (DllSurrogate in registry). I know how to do that, but it means that all COM objects will become out of process.
In the C++ I had the code: CoCreateInstance(CLSID_SomeClass, NULL, CLSCTX_INPROC_SERVER, IID_SomeInterface, (void**)&pobj);
It worked fine, but as soon as I switch to CLSCTX_LOCAL_SERVER (and add registry keys for DllSurrogate), it can't find interfaces (error 0x80004002). I checked registry and found out that when .NET COM DLL is registered, it adds ClsID registry keys,开发者_如何转开发 but doesn't add Interface and TypeLib registry key.
The question is, how to create these registry keys for .NET COM?
Regards, Victor
If you want everything in-process then both the application and the COM object must be in 64-bit. See Can I load a 32 bit DLL into a 64 bit process on Windows?.
精彩评论