Resolving Side-by-Side Configuration Issues
I've been meaning to blog about this for well over a year now, but for some reason I never got round to it. This came up in conversation the other day with a couple of workmates and it prompted me to revisit the issue.
Have you ever fired up an application on Windows XP and got the following error?
The application has failed to start because the application configuration is incorrect. Reinstalling the application may fix this problem.
Informative isn't it! What about if you fire up the same application on Windows Vista?
The application has failed to start because its side-by-side configuration is incorrect. Please see the application event log for more detail.
This does tell us a little bit more about the problem, but not a lot more.
The fact is that the first error message above is useless, and the second is useless to everyone except those who know all about WinSxS (side-by-side). I'm not going to go into detail about WinSxS in this article, but the short description is: it's an attempt at alleviating DLL hell.
When a binary component links against a DLL, such as MS's CRT, an entry for that dependant DLL is specified in the component's manifest. This tells Windows that the application can't run without those DLLs being present. If they're not present in WinSxS then the errors above are thrown in the user's face.
To demonstrate the problem, consider the C++ program below.
#include <windows.h> #include <tchar.h> int WINAPI _tWinMain(HINSTANCE instance, HINSTANCE prevInstance, LPTSTR cmdLine, int cmdShow) { ::MessageBox(NULL, _T("This is a text executable that links against a later version of the runtimes."), _T("Test EXE"), MB_OK); return 0; }
Compile this on a machine with Vis Studio 2008 installed and the resulting EXE will be linked against version 9.0 of the CRT.
Here is the result of running this on an XP machine without that runtime installed:
Here's the same application running on Vista, again without the runtime installed:

Let's now pretend that we don't know why this problem is occuring and attempt to ascertain the reason for the error.
First off, we need to locate the application's manifest. This can be found either in a appname.exe.manifest file, or inside the binary itself. In our case, the manifest is embedded so we need to open up the file in a binary/hex editor (or at least an editor that allows you to view the content of binary files). I used VIM, but there are other options such as UltraEdit and the free Cynus editor.
Manifest information is usually stored towards the end of the file, so after opening it in your editor of choice, scroll to the end of the file and slowly scroll up. When you reach a section that contains what looks to be XML then you've probably found it. It usually lies just above a section of padding that looks like this:
0001ab0: 5041 4444 494e 4758 5850 4144 4449 4e47 PADDINGXXPADDING 0001ac0: 5041 4444 494e 4758 5850 4144 4449 4e47 PADDINGXXPADDING 0001ad0: 5041 4444 494e 4758 5850 4144 4449 4e47 PADDINGXXPADDING 0001ae0: 5041 4444 494e 4758 5850 4144 4449 4e47 PADDINGXXPADDING 0001af0: 5041 4444 494e 4758 5850 4144 4449 4e47 PADDINGXXPADDING 0001b00: 5041 4444 494e 4758 5850 4144 4449 4e47 PADDINGXXPADDING 0001b10: 5041 4444 494e 4758 5850 4144 4449 4e47 PADDINGXXPADDING 0001b20: 5041 4444 494e 4758 5850 4144 4449 4e47 PADDINGXXPADDING 0001b30: 5041 4444 494e 4758 5850 4144 4449 4e47 PADDINGXXPADDING 0001b40: 5041 4444 494e 4758 5850 4144 4449 4e47 PADDINGXXPADDING 0001b50: 5041 4444 494e 4758 5850 4144 4449 4e47 PADDINGXXPADDING 0001b60: 5041 4444 494e 4758 5850 4144 4449 4e47 PADDINGXXPADDING 0001b70: 5041 4444 494e 4758 5850 4144 4449 4e47 PADDINGXXPADDING
The manifest XML usually begins with an assembly tag. In the case of this example, it looks like this:
0001850: e404 0000 0000 0000 3c61 7373 656d 626c .......... .. < 00018e0: 7365 6375 7269 7479 3e0d 0a20 2020 2020 security>.. 00018f0: 203c 7265 7175 6573 7465 6450 7269 7669 .. 0001910: 3c72 6571 7565 7374 6564 4578 6563 7574 .. 0001970: 7265 7175 6573 7465 6450 7269 7669 6c65 requestedPrivile 0001980: 6765 733e 0d0a 2020 2020 3c2f 7365 6375 ges>.. .. .. .. .. 00019d0: 2020 2020 2020 3c61 7373 656d 626c 7949 .. 0001a90: 0d0a 2020 3c2f 6465 7065 6e64 656e 6379 .. ..PA
In case you don't find this very readable, here it is after extraction/formatting:
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0"> <trustInfo xmlns="urn:schemas-microsoft-com:asm.v3"> <security> <requestedPrivileges> <requestedExecutionLevel level="asInvoker" uiAccess="false"></requestedExecutionLevel> </requestedPrivileges> </security> </trustInfo> <dependency> <dependentAssembly> <assemblyIdentity type="win32" name="Microsoft.VC90.CRT" version="9.0.21022.8" processorArchitecture="x86" publicKeyToken="1fc8b3b9a1e18e3b"> </assemblyIdentity> </dependentAssembly> </dependency> </assembly>
The bit we're really interested in is:
<dependentAssembly>
<assemblyIdentity type="win32" name="Microsoft.VC90.CRT" version="9.0.21022.8" processorArchitecture="x86" publicKeyToken="1fc8b3b9a1e18e3b"></assemblyIdentity>
</dependentAssembly>
This tells us the exact component and version required for this application to run. You'll notice that it also mentions the processor architecture. In this case, we need to make sure that we have version 9.0.21022.8 of the Visual C Runtimes for x86 installed in the side-by-side folder. The WinSxS folder can be found at %WINDIR%\WinSxS
Inside that folder you'll probably see a stack of subfolders with crazy looking names. The one you would need to have to solve the problem above is called x86_microsoft.vc90.crt_1fc8b3b9a1e18e3b_9.0.21022.8_none_bcb86ed6ac711f91, which as you can see has a name that closely resembles the properties of the assemblyIdentity tag in the XML listed above.
If you can't find the appropriate folder in your WinSxS then you need to download an installer that contains the appropriate components and install it.When installed, the application should run without a problem, and you should get a message like this:

Hope that helps!
Edit (3rd Jan '09): A nifty tool has been built by Kenny Kerr which makes viewing manifest information much easier. Pointer your browser this way and check it out. It should help when tryinig to resolve this problem.
-
stevekershaw
-
Sally Shine
-
OJ
-
Sally Shine
-
triniwondaboy
-
OJ
-
triniwondaboy
-
OJ
-
triniwondaboy
-
triniwondaboy
-
triniwondaboy
-
OJ
-
triniwondaboy
-
OJ
-
triniwondaboy
-
OJ
-
Q
-
OJ
-
Q
-
OJ
-
Robert Greyling
-
Steven Jay
-
OJ
-
governmentwhizz
-
Martin
-
OJ
-
Keef
-
OJ
-
Martin
-
OJ
-
Martin
-
OJ
-
OJ
-
Bobo
-
Bobo
-
OJ
-
oras
-
Brady
-
OJ
-
Jin
