views:

196

answers:

2

I have an application that contains a VC++ project (along with C# projects). Previously, (i.e. during the last year or so) when a build has been done, Visual Studio 2005 appears to be targeting the VC++ runtime version 8.0.50727.762. At least, that is what the Assembly.dll.intermediate.manifest file is telling me:

<?xml version='1.0' encoding='UTF-8' standalone='yes'?>
<assembly xmlns='urn:schemas-microsoft-com:asm.v1' manifestVersion='1.0'>
  <dependency>
    <dependentAssembly>
      <assemblyIdentity type='win32' name='Microsoft.VC80.CRT' version='8.0.50727.762' processorArchitecture='x86' publicKeyToken='1fc8b3b9a1e18e3b' />
    </dependentAssembly>
  </dependency>
</assembly>

This version number matches the Visual Studio 2005 version number. The application worked fine when deployed to the webserver. The sun was shining, the birds were singing and all was right with the world.

Now something has changed. I don't know what - a security patch, an obscure Visual Studio setting or something. Now Visual Studio 2005 seems to be targeting the wrong version of the VC++ runtime:

<?xml version='1.0' encoding='UTF-8' standalone='yes'?>
<assembly xmlns='urn:schemas-microsoft-com:asm.v1' manifestVersion='1.0'>
  <dependency>
    <dependentAssembly>
      <assemblyIdentity type='win32' name='Microsoft.VC80.CRT' version='8.0.50727.4053' processorArchitecture='x86' publicKeyToken='1fc8b3b9a1e18e3b' />
    </dependentAssembly>
  </dependency>
</assembly>

When I deploy the application to the webserver, I get the dreaded This application has failed to start because the application configuration is incorrect. Reinstalling the application may fix this problem. (Exception from HRESULT: 0x800736B1) error.

This problem occurs even when I recompile previous versions of the application. I can absolutely guarantee that nothing at all has changed in the solution - we zip up the entire contents of the solution as part of the build process and archive it. I have unzipped a number of these to a temp directory, verified that the previous manifest file refers to 8.0.50727.762, recompiled using exactly the same command at the command line and then verified that the new manifest file now refers to 8.0.50727.4053.

I am using Microsoft Visual Studio 2005 Version 8.0.50727.762 (SP.050727-7600) and Microsoft Visual C++ 2005 77646-008-0000007-41610.

Why would Visual Studio revert to a previous version of the VC++ runtime? How do I specify which version it should use? What is going wrong here?

Update

OMG - I am such an idiot. X.7 > X.4, but, X.762 < X.4053 where X is a version number. So 8.0.50727.4053 is more recent than 8.0.50727.762. The whole thing makes sense now. I am leaving this as personal reminder for all the times I think I am the cleverest person in the world...

A: 

What probably happened was your dev machine installed a new service update that updates the VC++ runtime. No big deal really, just install all your needed updates on your web server and things will be peachy again.

If you really need to revert back, then you would need to find and uninstall the update that changes the runtime library, there is no way to change the selected runtime in vs 2005, it will use the most current and up to date one it finds.

Charles
A: 

Use _BIND_TO_CURRENT_XXX_VERSION 1 (where XXX is CRT/MFC/ATL/OPENMP) to choose between VCRedist of VistualStudio RTM and latest on your dev box.

http://msdn.microsoft.com/en-us/library/cc664727%28VS.90%29.aspx

PS: Not much sure but there has been issues reported with _BIND_TO_CURRENT_VCLIBS_VERSION, so better use macro for each MFC/ATL etc.

Vipin