Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Binary compiled for VS2008 needs DebugCRT side-by-side assembly, doesn't work in VS2010

I'm working with VS2010 on a project that uses Havok, and the latest release only has VS2008 and earlier binaries. The embedded manifest generated by VS contains the following

<assemblyIdentity type="win32" name="Microsoft.VC90.DebugCRT" version="9.0.21022.8" processorArchitecture="x86" publicKeyToken="1fc8b3b9a1e18e3b"></assemblyIdentity>

Since apparently VS no longer uses side-by-side assemblies (source) starting with 2010, my winsxs directory doesn't have the debug crt assemblies installed, and the vs redistributable package doesn't install the debug versions. If we compile the dlls that use Havok with an embedded manifest, applications loading the dlls fail to start.

I ran sxstrace and got the following:

INFO: Begin assembly probing.
INFO: Did not find the assembly in WinSxS.
INFO: Attempt to probe manifest at G:\Windows\assembly\GAC_32\Microsoft.VC90.DebugCRT\9.0.21022.8__1fc8b3b9a1e18e3b\Microsoft.VC90.DebugCRT.DLL.
INFO: Attempt to probe manifest at D:\Projects\GTS new\bld\Debug\Microsoft.VC90.DebugCRT.DLL.
INFO: Attempt to probe manifest at D:\Projects\GTS new\bld\Debug\Microsoft.VC90.DebugCRT.MANIFEST.
INFO: Attempt to probe manifest at D:\Projects\GTS new\bld\Debug\Microsoft.VC90.DebugCRT\Microsoft.VC90.DebugCRT.DLL.
INFO: Attempt to probe manifest at D:\Projects\GTS new\bld\Debug\Microsoft.VC90.DebugCRT\Microsoft.VC90.DebugCRT.MANIFEST.
INFO: Did not find manifest for culture Neutral.
INFO: End assembly probing.
ERROR: Cannot resolve reference Microsoft.VC90.DebugCRT,processorArchitecture="x86",publicKeyToken="1fc8b3b9a1e18e3b",type="win32",version="9.0.21022.8".
ERROR: Activation Context generation failed.
End Activation Context Generation.

The applications work on one of my coworker's machines, since (presumably) he had VS2008 installed on it, but not on another coworker's or mine, since we have only had VS2010 installed. The only debugcrt files the working machine has in the winsxs directory are

x86_microsoft.vc90.debugcrt_1fc8b3b9a1e18e3b_9.0.30729.1_none_bb1f6aa1308c35eb

as a folder with the dlls, a .manifest file, and a .cat file (same publicKeyToken but different version)

I've tried copying the files over to my winsxs directory, which didn't fix the problem. Placing the dlls directly into the directory with the binaries also did nothing. Placing the files into bin\Microsoft.VC90.DebugCRT.DLL (since that was one of the directories searched according to sxstrace) also failed to help, but the output from sxstrace changed to

INFO: Begin assembly probing.
INFO: Did not find the assembly in WinSxS.
INFO: Attempt to probe manifest at G:\Windows\assembly\GAC_32\Microsoft.VC90.DebugCRT\9.0.21022.8__1fc8b3b9a1e18e3b\Microsoft.VC90.DebugCRT.DLL.
INFO: Attempt to probe manifest at D:\Projects\GTS new\bld\Debug\Microsoft.VC90.DebugCRT.DLL.
INFO: End assembly probing.
ERROR: Activation Context generation failed.

(it stops searching, and is able to resolve the reference but context generation still fails)

The only thing that works is disabling embedded manifest generation. Is there another way of resolving this?

like image 555
atarck Avatar asked May 29 '11 03:05

atarck


1 Answers

On the working computer, look in the folder:

C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\redist\Debug_NonRedist\x86\Microsoft.VC90.DebugCRT

This is where the runtime dlls of the version needed to run are located. There is also a manifest file there. You can look in the event viewer (eventvwr.exe) to see which version of the DLLs the exe is looking for, and then you can modify the manifest file (rather, modify a copy that you place in the executable directory with the dlls) so it will identify the included files as being that version.

like image 194
Mozzis Avatar answered Oct 18 '22 23:10

Mozzis