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()?

1 Answer 1

4

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 
Sign up to request clarification or add additional context in comments.

2 Comments

Thanks. I had tried this already, but I've discovered that I have to use the /codebase option on regasm. Despite the fact that regasm a dire warning, and suggests that this option is not suitable, it works only when the /codebase flag is used. All good now, thanks.
I just successfully used regasm from Framework64\v4.0.30319 to register a C# ActiveX for use from a x64 C++ process via CLSIDFromProgID and CoCreateInstance without the /codebase flag...

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.