OJ’s rants What would OJ do?

17May/0861

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:

Windows XP Error

Here's the same application running on Vista, again without the runtime installed:
WinSxS error on Vista

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  ..      ..    ..  ..  ..    ..
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:
The resulting message box shown when the test application\'s side-by-side configuration is correct

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.

Comments (61) Trackbacks (0)
  1. Did a search and its in the system32 folder

  2. I ran into this problem while trying to load Sketchup. Tried installing the runtimes a gazillion times already, only to piss me off with an annoying SxS conflict message. I then viewed the manifest using Reshack, and it calls for version 8.0.50727.762 of CRT and MFC.

    Can anyone give me a clue on how to fix this, without reinstalling Windows?

  3. Bear in mine that Side by Side errors might occur when one of the DLLs your program relies on is missing one of it's dependencies. That is, make sure your entire dependency tree exists. Depends.exe is a great tool for visualising this.

  4. Thanks, although I reinstalled Windows out of frustration. Might as well take a peek into the problem next time, though.

  5. Hiya OJ. I am getting the “The application has failed to start because its side-by-side configuration is incorrect. Please see the application event log for more detail.” message when my kids try to install games. I am not very well up on computers and have been looking for an easy way to fix the problem. I dont want to get rid of the games if there is an easy solution. Could you please reply to stephenmkershaw@hotmail.com with any help you could provide. Many thanks.

  6. I had this problem for a long time, tried everything, or at least I thought i did. well I fixed this by clearing the browsing data in Google Chrome. That's it, now I can use msn/aim and a few other programs again. Hope this helps!

  7. Yes, reinstalling the application can fix the error sometimes:)

  8. Hello, since I'm on this I have obviously gotten this same error. I'm only 16 and I'm not a big tech person so I tried to read what you wrote and just had this big question mark over my head lol XD The program that I'm trying to run is the portable version of Sony Vegas Pro 9. When I double click on the icon to run the program I get the error as seen above (I have 2 comps. One is vista and the other is XP so I got the pleasure of seeing both versions of the error -_-) I was just wondering if maybe you could further explain what I need to do to resolve this error. Thank you for your help

  9. Have you followed the instructions that I have listed and determined which libraries are missing?

  10. OJ you rock!. From this short article I managed to understand more about the problem than from number of forums and MSDN resources. I had a frustrating problem here to solve. This way I found out that one of 3rd party dlls depended on DebugCRT which is not distributed in redist packages. I just copied correct version from one of development stations and it worked like a charm.

  11. Hi Emil,

    Thanks for the feedback. Very happy to hear that this article helped you sort out your problem :) All the best!

    OJ


Leave a comment


No trackbacks yet.

blog comments powered by Disqus