A customer had migrated from 32-bit Windows XP to 64-bit Windows 8 and many of their .NET apps failed to launch, with an error like below:
The registry key for HKCR\CLSID\<GUID> was present, and the relevant OCX/DLL had been registered and was present on the system.
When you see error 800700c1 typically the issue is you have a 64-bit EXE trying to load a 32-bit DLL, which is not possible in Windows.
This issue is typically unique to .NET applications that also load native DLLs, because they can be compiled to “ANY CPU”
We should check the .NET exe with with CorFlags ( http://msdn.microsoft.com/en-us/library/ms164699%28VS.80%29.aspx )
This tool is available from the Windows SDK in the .NET Development Tools subcomponent (Developer Tools -> Windows Development Tools -> .NET Development Tools)
We can see with 32bitreq = 0, this is set to “ANY CPU” This means it will run as 64-bit EXE on Windows x64 and 32-bit EXE on 32-bit Windows. As a consequence
- Any native DLLs it loads must be 64-bit
- Any installer that installs reg keys must be marked as 64-bit so reg keys go to correct location
If the application needs/benefits from addressing more than 2GB of RAM then it may be best to leave it as “Any CPU” However then 64-bit versions of all DLLs it loads need to be installed/registered.
The easiest way to fix such an application is to change app to x86.
This can be done with compiler options in Visual Studio
Or the EXE can be modified using corflags.exe
corflags /32bit+ C:\source\wds\wds.exe
Now the EXE will run in 32-bit mode, even on x64 OS.