views:

335

answers:

1

When I run an executable that I built, I get the following error:

The system cannot execute the specified program

My immediate thought was that it was a dependency problem with one of the VC8.0 re-distributable DLLs (msvcr80d.dll et al.). We have had a few problems with patched versions of these DLLs affecting our programs.

When I opened my executable under Dependency Walker, the following errors are displayed:

Error: The Side-by-Side configuration information in "w:\MYPROGRAM.EXE.manifest" 
       contains errors. This application has failed to start because the
       application configuration is incorrect. Reinstalling the application may
       fix this problem (14001).
Warning: At least one delay-load dependency module was not found.
Warning: At least one module has an unresolved import due to a missing export
         function in a delay-load dependent module.

If I open up the manifest file for my executable, it has the following in it:

<?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.DebugCRT' version='8.0.50727.762' processorArchitecture='x86' publicKeyToken='1fc8b3b9a1e18e3b' />
    </dependentAssembly>
  </dependency>
  <dependency>
    <dependentAssembly>
      <assemblyIdentity type='win32' name='Microsoft.VC80.DebugCRT' version='8.0.50727.4053' processorArchitecture='x86' publicKeyToken='1fc8b3b9a1e18e3b' />
    </dependentAssembly>
  </dependency>
</assembly>

It seems to have 2 copies of the Microsoft.VC80.DebugCRT dependent assembly in it.

The 8.0.50727.4053 version of the assembly is not in my side-by-side configuration (I believe this version comes with a Visual Studio patch which is not installed).

If I remove this assembly from the manifest file, the executable runs fine.

However, when I re-build my application, the manifest is re-generated and the extra dependency is added again.

What causes this dependency to be added to the manifest? I'm guessing it has something to do with another DLL which my application depends on being built on another PC with a different set of re-distributable DLLs, but I want to confirm this.

Update:

I have tried a lot of the suggestions in this blog post, without a lot of luck. One thing that is strange is that the manifest generated when I do a Release build doesn't include the 8.0.50727.4053 entry, but the Debug build does.

+1  A: 

You are right. Security update for Visual C++ 2005 SP1 forces your app to use a newer version of CRT and MFC (8.0.50727.4053 instead of 8.0.50727.762). As it maybe compatible, it's better to use the new one. You should distribute with your app also the vcredist_x86.exe.

As I now, VS C++ does not scan for dependency, so the manifest is generated from the core VS (you can manualy control it by project settings). I thing the VS update was installed on the development PC, so VS reflect it in the manifest.

Igor
This doesn't really answer his question of *why VS adds both versions to the manifest*.
jalf