简体   繁体   中英

COM .NET DLL not registering in the GAC (REGDB_E_CLASSNOTREG)

I built a .net COM dll (debug x64) on one machine. I have it all setup and working there (I can see it in C:\\Windows\\Micorosft.NET\\assembly and OLEVIEWER).

I took the dll to another machine (along with it's .h and .c file generated from MIDL). I register the dll into the GAC by following these steps http://codeingaddiction.blogspot.com/2011/06/how-to-add-strong-name-to-existing-dll_16.html - create key pair, generate MISL, rebuild assembly from MISL with the key, and then adding it to the GAC. It seems to be in the GAC, and I can try searching for it with gacutil /l MyDllName. However, in my client application, when I link against it, at run time when invoking CoCreateInstance I get REGDB_E_CLASSNOTREG (HRESULT). I can't see the dll in C:\\Windows\\Microsoft.NET/Assembly nor in OLEVIEW.

Have I missed out any steps, or done something wrong?

Thanks

The reason you are getting the error REGDB_E_CLASSNOTREG is because your .net COM DLL is not registered. Any .net assembly needs to be registered for it to be exposed as a com class to the clients. We need to use regasm.exe to register the .net assembly.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM