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.

40 Comments

  1. Keef says:

    This is such an annoying problem. Windows really needs a mechanism to find and download dependencies of applications (kinda like the package managers in many Linux distributions). The average user is gonna have no clue at all what to do about this kind of thing and the error message really isn’t helpful.

    I guess it would be possible to make your app detect that the dependencies aren’t there and to give the user a better message, but that’s just more work for the dev that really doesn’t need to happen.

  2. OJ says:

    The thing that amazes me about this is that in the “old” days you used to get a message box saying something like “Unable to find Foo.dll”. At least it told you the name of the dependency. The SxS stuff doesn’t.

    I think that one of two things should happen:

    1. The compiler generates code to check for the dependencies and inform the user of the missing file(s) so that it can be fixed easily.
    2. The OS generates the error for you.

    I really don’t think it should be the job of the devs, to handle this every time. I certainly don’t think you should have to worry about it in the case of Microsoft’s runtimes.

  3. Keef says:

    Yeah, I wasn’t saying it *should* be the application developers job to write code to detect this and give a better error message, but in the meantime it might be a good way to reduce support calls since the OS is so useless at it.

    Ideally, the OS should be able to put up a message saying that the runtime is missing and offer to download and install it for you.

  4. mathmax says:

    I don’t have a folder called x86_microsoft.vc90.crt_1fc8b3b9a1e18e3b_9.0.21022.8_none_bcb86ed6ac711f91 in WinS*S.
    Where can I download it ?

  5. OJ says:

    @mathmax: Since I’m a nice guy, I’m going to answer your question, but in future you should use manners.

    Based on the folder you listed, you are missing version 9 of Microsoft’s VC++ runtimes, which is the runtimes required by applications built using Visual Studio 2008.

    Doing a simple Google search for this revealed this download link.

    Hope that helps :)

  6. mathmax says:

    Thank you for your help and sorry for being so brief in my last post.

    I’ve installed the package on the link you gave. It although doesn’t solve my problem. I always get the error message when trying to execute the program with the Visual Studio Debugger.
    I also had a look at the bin folder and have been surprised to see that there is no .exe file inside (only .obj files).
    Do you have an idea of the problem ?

    Regards,

    mathmax

  7. OJ says:

    @mathmax: No worries mate, no hard feelings :)
    I have seen this issue before. It sounds like the install of the runtimes is silently failing. The last time I saw this was when I tried to install the runtimes on a Vista machine. Are you using Vista? If so, are you running the install as an Administrator? Make sure that you do right-click and “Run as Administrator” even if the account you login as is an Admin too.

  8. OJ says:

    I’ve just been having a chat with Chris, who among others, have had this problem specifically when installing AVG antivirus (who I refuse to link to considering they are shipping products without the necessary runtimes).

    If you’re having problems after installing AVG, chances are your WinSxS is missing this folder: x86_microsoft.vc90.crt_1fc8b3b9a1e18e3b_9.0.21022.8_none_bcb86ed6ac711f91

    If this is the case, you’ll need to get a copy of the Visual Studio 2008 runtimes for the x86 platform, located here. Make sure you run the install as Administrator if you run Vista (yes, even if you have UAC turned off). After running the install, make sure the folder above appears in your WinSxS folder, and that there are 3 DLL files in there.

    Give me a shout if you’re still having issues.

  9. OJ says:

    After a bit more investigation and work alongside Chris, it appears that you also need the Vis Studio 2005 runtimes. WTF are AVG playing at?!

  10. Rob G says:

    Yet another reason to add to my list of why I don’t install antivirus packages :-)

  11. Keef says:

    Yikes!  I’m using AVG 8 on Vista 64, though I had Visual Studio 2008 installed first so I guess that’s why I’ve never had the problem.

    Shame cos it’s a really good free unintrusive AV program that does well in tests and doesn’t bog down your PC (yes you Symantec!!!).

  12. OJ says:

    Avast is a way better option (imho). I don’t have AV running on my new laptop either. I don’t download dodgey stuff, I don’t have outlook installed, I just use webmail. I don’t open dodgey emails regardless of the client that I use. I guess I agree with Rob and Atwood. AV is a waste of time if you’re not doing anything dodgey :)

  13. Dee Mai says:

    Hey Oj
    I have the Winsxs and everything but for some reason this folder x86_microsoft.vc90.crt_1fc8b3b9a1e18e3b_9.0.21022.8_none_bcb86ed6ac711f91, is the only one that is missing. Where can i go to just download this file?

  14. OJ says:

    @Dee Mai: The link for that download has been posted twice already in this thread. Scroll up and read the previous comments.

  15. OJ says:

    Apparently AVG has finally fixed their issue. If you come here looking for a fix to this problem for your AVG install, try going back to AVG’s site and grabbing the latest installer.

  16. Jin says:

    OJ -

    I have been struggling with this problem for the last week, just wanted to say that your solution worked like a charm.  For anyone else who stumbles across this site:

    1) Download the Microsoft Visual C++ 2008 SP1 Redistributable Package (x86) – http://www.microsoft.com/downloads/details.aspx?familyid=A5C84275-3B97-4AB7-A40D-3802B2AF5FC2&displaylang=en

    (sorry – don’t know HTML)

    2) Install as Administrator - right click the file and “Run as Administrator”

    Thanks again OJ and everyone else who was helpful on this problem,

  17. OJ says:

    Hi Jin,

    Thanks for your comment! I am happy that you found the site useful and that you’ve managed to resolve your problem. Thanks for the link! All the best :)

  18. Brady says:

    Please Please Help ME…

    I know computers fairly well, however I am new to 64 bit.
    For some strange reason my Vista 64 started giving me sideby side errors.
    Every single 32 bit app (Program files(x86)) apps give me the error, while any 64 bit apps dont.
    Trolling for a few hours I found the most common solution to be installing vcredist_x86  This file wont install it gives me the same error.
    So I downloaded vcredist_x64, but this file is built with a 32 bit self extractor and results with the same error.  I Tried uninstalling the Visual Studio 05 but it gives me a windows installer can not be accessed.

    I have tried using a restore point, I have tried sfc /f and it failed.

    Is there some trigger that can enable windows 32 bit installs to work and I can install vcredist_x86?  Thanks.

  19. oras says:

    hi there i have this problem with my adobe after effect cs3 any way i install all links Microsoft Visual C++ 2008 SP1 Redistributable Package (x86)
    but still dont get that file u called x86_microsoft.vc90.crt_1fc8b3b9a1e18e3b_9.0.21022.8_none_bcb86ed6ac711f91
    pls help ^^

  20. OJ says:

    @oras: Are you running Vista? If so, you need to make sure you run the install as an administrator, even if you’re an admin yourself.

  21. Bobo says:

    I know a little about computers thru trial and error, but upon seeing OJ suggest different things that could be possible for the “This applicaiton has failed to start because the application configuration is incorrect“…btw i had uninstalled AVG due to it not updating no matter whati did..so upon reinstalling, i got the error mentioned above.  Now i notice Oj said avg had resolved the issue with their installers and this was dated in july..I tried downloading the newest installers last night.(now December) and still getting same error…I tip my hat to you OJ for ur knowhow..this site is closest i’ve been to an answer and u gave me hope..i want to wait and see if u answer me before attempting again, i really like avg as i can not afford to pay for an AV program…Will the above link u gave us self install and if i have the file..will it overwrite or prompt me….Thank you again and i wish u the merriest of the holidays

  22. Bobo says:

    Btw..i’m Running xp sp2..i apologize for not entering that in my last post

  23. OJ says:

    @Bobo: Thank you for your comment. I’m glad you find the site useful and have been given a bit of hope! Sorry for taking so long to respond. The Christmas period has been pretty busy for me, and the time I’ve had to get online I’ve spent doing other things.

    So you’re trying to use AVG on XP sp2, and you’re getting the dreaded “application configuration” error message. Given that you’ve said you’ve got the latest version of the AVG installer, perhaps they’ve now made the mistake again. My guess is that last time they moved from Visual Studio 2003 to 2005, they didn’t update their installers with the VC runtimes that are required with 2005 builds. Perhaps lately they’ve finally updated their environments to 2008, and hence need to do the same again? They might even have service pack issues for their runtimes. Who knows? :)
    I haven’t checked out the forums of late to see if AVG are aware of the issue, but I’m guessing not.

    Have you attempted to see which files are missing on your system? Have you managed to determine, via the method above, which folder the application is looking for in WinSxS?

    I’m going to take a stab in the dark and recommend you install the latest VC++ runtimes, for both 2005 and 2008. Download them from Microsoft.com and install them both. See if that fixes your problem. You can get them here:

    Both of those links are for the 32-bit versions. If you are still having issues, then perhaps it’s time to ditch AVG? I personally am not a fan of the software, and given that they have so many issues with their installers I don’t think they deserve to have you as a user. If you’re looking for a high quality personal antivirus solution, I recommend using Avast. You have to register, but it’s free for personal use (you don’t need to enter credit card details or anything, just an email address). It’s a great piece of software, and in the past has picked up viruses on machines that AVG has failed to find.

    I hope that helps! Good luck and happy new year ;)

  24. OJ says:

    Hey all, I just added a footnote to the post regarding a tool which will make this process a little easier. Check it out!

  25. Martin says:

    Hi all,

    Thanks for the article. I finally understood these side-by-side problems. I am playing with an app developed on VS2008. I link *statically* to the C runtime libraries. Why, on Earth, I still have embedded manifest with a dependency name=’Microsoft.VC90.DebugCRT’ version=’9.0.21022.8′? How can I modify the content of the manifest? Any help will be highly appreciated.

    Martin

  26. OJ says:

    @Martin: Glad to hear that the articles has helped clarify how it works.

    Regarding your issue, it seems to me that there’s something else that might be biting you in the butt. I need to clarify a couple of things first:

    1) Are you creating a debug build or release build?
    2) Are you linking to any other third party libraries?

    If you’re creating a release build, this will indicate that some other library that you’re linking to has a reference to the debug runtimes. If that’s the case then you’ll have to get that library rebuilt so that it either links to the release version of the CRT or statically links. This might be an issue even if you’re creating debug builds. Just be wary of what you link into your project as you might get some stragglers with it.

    Statically linking libraries should remove the need for the associated DLL, so there has to be some libary that you’re including which dynamically links to the debug CRT.

    I hope that points you in the right direction. You shouldn’t ever have to manually modify the manifest. If it has things in there that shouldn’t be, then it indicates that there’s a problem with your build.

    Good luck, let us know how you go :) OJ

  27. Martin says:

    Hello OJ,

    Thank you for the reply. I actually build the MS LSP example from the SDK by creating a solution and two projects in VS2008. On Release buid I statically link to the C runtime library but the manifest that is embedded still has a demendency on the VC90 which is quite odd. I modified the manifest through the Resource Editor from inside VS and managed to get rid of the dependency. Now on an out-of-the-box Windows XP Home the program is running without the side-by-side error.

    I am not sure if this workaround should be done or should I keep on searching for some project properties since I think the problem is in them.

    Martin

  28. OJ says:

    @Martin: I highly recommend that you do not go with the hacking manifest solution. The manifest includes the dependency because something in the code needs it.

    Just because the program runs it doesn’t mean it won’t crash at any time. The thing is, when the application runs, it might not initially need to access the functions that live in the debug CRT. You may find that you’ll have to perform a certain function before the program looks for the CRT, and that is the point that the application will crash.

    You obviously don’t want this ;) I don’t have time to download and compile the sample that you’re talking about, but by the sounds of it that sample is somehow including a reference to the debug CRT.

    Can you have a look through the project settings, and all the #pragma statements, and list the libaries that are being linked? (make sure you check across all configurations). If you list them here maybe we can figure it out.

    Cheers!

  29. Keef says:

    @Martin: Could you use a Dependency Chaser type app on your executable to work out the tree of dependencies to help you narrow down which module is pulling in the debug CRT (if its something that’s not obvious from the project settings)?  We’re using a nice app at work that helped me work out a Managed DirectX versioning problem the other day, though I’m not sure where it came from.  I’ll look it up on Monday and post here again.

  30. OJ says:

    @Keef: That probably won’t help. If Martin is statically linking  libraries then the only binary that has the dependency will be the one he creates. Given that his exe’s manifest is the one with the dependency, Dependency Viewer will simply say that his exe is what depends on the DLL.

    You need to find which static libs have the dependency before you link them in to your binary.

  31. Martin says:

    Hello OJ and Keef,

    Sorry for answering late but I was away. Thinks are quit strange (at least to me). So, in the project, in Release build I statically link to the CRT. Still in the manifest there is a dependency on the CRT DLL. With Dependency Walker I see “MSVCRT.DLL”.  What is this file? It is included in Windows XP by default. This project uses only standard Windows libraries. How can it be possible to depend on the dynamic CRT? Any ideas will be greatly appreciated.

  32. governmentwhizz says:

    hey oj
    im having this problem after downloading the newst msn messenger i downloaded the VIM you suggested in your blog but after that im lost. Please could you give me some steps to follow thanks id really appreciate that

  33. OJ says:

    @Martin: The Dependency Walker is telling you what we already know — ie. your exe is bound to the runtimes. What we don’t know is why. You need to determine which, if any, of the libraries you’re linking to have a dependency to the CRT. I’m not sure which, if any, Win32 libraries have that dependency either.

    Any chance you can zip up your project and send it over so we can take a look at how it’s set up?

    @governmentwhizz: The steps to follow to determine the dependency that you’re missing are listed in the article already. I’m guessing you’re not too savvy with VIM (I love it, but realise it’s a little esoteric for people who aren’t familiar with it), so I think you should use a tool that makes it easier. If you see the annotation at the bottom of my article, you’ll see that I’ve linked to this tool, which shows you the content of the file’s manifest. This will tell you what’s missing without you having to do any of the complicated steps. Download it, fire it up and use it to track down your dependency. Good luck!

  34. Steven Jay says:

    Hi,
    I desperately need help, and would be grateful if you could.
    My work computer is broken, and I am the IT guy by default (Meaning I have more experience than my two colleagues!).  The bulk of this main post is over my head, for example.
    I am running Windows Vista.  I recently downloaded a program for which I had to also install Microsoft .NET framework (whatever that is).  Immediatly after that, and since, I have been unable to open any Microsoft Office programs, getting this dreaded ’side-by-side configuration’ message  After reading many other website’s I found I needed to download the Redistributable Package mentioned.  I did this and still had problems.  Then another website siggested uninstalling the programs that I have problems with, uninstalling the RP, then installing the RP and THEN the Office programs again.
    It still does not work.  Then I came here, and I downloaded the file and ran it as administrator, with no joy.  However, the file you mention to look for in the WinSys folder IS there.
    I have aldready got into problems because I uninstalled Office, only to realise that this PC was an ‘Office ready’ PC, and therefore does not have a disc to reinstall it.  I downloaded a trial and I can’t open it (because of this side-by-side issue) to try and convert it to the full package.
    Any help you can give me would be gratefully recieved!

  35. Bet you didn’t see that one coming! :-)
    Good luck solving it OJ…

  36. OJ says:

    @Rob: Er, yeah :)
    @Steven: You’re in a world of hurt mate. There’s a lot gone on there that I really can’t help with via a set of comments on a blog. You may find that your best option is to take your machine back to where you got it and get them to reinstall office. They should give you CDs as well, because you paid for the licence of the software and hence you should be entitied to reinstall it if required.

    Sorry. While I’m happy to share my experiences, I can’t really spend the time giving out free I.T. support. I hope you understand. Good luck!

  37. Q says:

    Hey OJ since you seem like the man at this stuff.  Let me tell you where I am.  This “Side-by-side configuration error”  Is everywhere on my Vista 64.  I can’t use Photoshop, Acrobat, and some random applications.  Now I went into the manifests and found

    x86_microsoft.vc90.crt_1fc8b3b9a1e18e3b_9.0.30729.1_none_e163563597edeada.manifest
    &
    x86_microsoft.vc90.crt_1fc8b3b9a1e18e3b_9.0.30729.1_none_e163563597edeada.cat

    I tried installing the Microsoft Visual C++ 2008 Redistributable package “right clicking run as administrator”  but it doesn’t seem like it goes through the entire installation.  It gets to “Gathering information” and just dissappears. 

    I successfully installed

    Microsoft Visual C++ 2008 SP1 Redistributable Package (x86).
    I don’t have Visual Studio so what am I missing?  Thanks in advance for all your work

  38. OJ says:

    @Q: Thanks for your post mate. Have you tried installing the redist for x64 first? You may find that it installs the x86 stuff behind the scenes?

    Try downloading and installing this and this (make sure you run as admin) and try again. Let me know how it goes.
    Good luck :)
  39. Q says:

    Tried both no luck.  I must say you have the most knowledge about this problem on the entire internet.  So what’s are my option (if any) besides reformatting?

  40. OJ says:

    @Q: I’m sorry to hear that it didn’t solve your problem. I’d just like to highlight one thing: even though it’s still not working it doesn’t mean that what you installed didn’t at least alleviate the problem.

    That is it may have solved the problem that you had initially, but perhaps now there is another dependency that it needs which it can’t find?
    At this point, may I suggest that you fire up Depends.exe and view the exe that you’re trying to run. See if it tells you which DLL it’s not able to find.
    I’m happy to chat to you about this real-time if you like. Ping me your email address via the contact form (please write it in the body of the mail as well ;)) and we’ll figure out a way to converse.
    Thanks for your kind words :) Reformatting is still a way off! I think we can solve it.
    OJ

Leave a Reply