How do I register a .NET DLL for 64-bit application

0

I have an 64-bit application that uses a .NET DLL, and is returning an error from CoCreateInstance() saying "class not registered". (0x80040154)

Now, this has been running fine as a 32-bit application for a long time, and has no problem calling the .NET DLL, which gets registered as part of the installation, or on my development machine, gets registered as part of the build process. The recent conversion to 64-bit application has started causing this error (the rest of the application is now running fine as 64-bit, so no other issues there).

The application is non-managed C++. The DLL is managed C#, .NET 2.0, and is set to "Any CPU". Both are built in VS2010. My install package uses Regasm to register the DLL, and I wondered if maybe I needed a 64-bit version of regasm, however, I believe I am already using that. Visual Studio is also set up to register the DLL as part of the build process, but even running the 64-bit program in the debugger still cannot find the class.

What do I need to do to register the DLL so that the 64-bit version of the program can find the DLL through CoCreateInstance()?

c#
c++
.net
asked on Stack Overflow Jan 25, 2019 by user1961169

1 Answer

2

Probably your installer uses 32 bit regasm from:

C:\Windows\Microsoft.NET\Framework\v4.0.30319\RegAsm.exe

But it should use 64 bit regasm:

C:\Windows\Microsoft.NET\Framework64\v4.0.30319\RegAsm.exe
answered on Stack Overflow Jan 25, 2019 by Access Denied

User contributions licensed under CC BY-SA 3.0