title: Need insight into how manifest is being generated for C++ program
body: <p>When I run an executable that I built, I get the following error:</p>
  
  <blockquote>
    <p>The system cannot execute the specified program</p>
  </blockquote>
  
  <p>My immediate thought was that it was a dependency problem with one of the VC8.0 re-distributable DLLs (<code>msvcr80d.dll</code> et al.). We have had a few problems with patched versions of these DLLs affecting our programs.</p>
  
  <p>When I opened my executable under Dependency Walker, the following errors are displayed:</p>
  
  <pre><code>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.
  </code></pre>
  
  <p>If I open up the manifest file for my executable, it has the following in it:</p>
  
  <pre><code>&lt;?xml version='1.0' encoding='UTF-8' standalone='yes'?&gt;
  &lt;assembly xmlns='urn:schemas-microsoft-com:asm.v1' manifestVersion='1.0'&gt;
    &lt;dependency&gt;
      &lt;dependentAssembly&gt;
        &lt;assemblyIdentity type='win32' name='Microsoft.VC80.DebugCRT' version='8.0.50727.762' processorArchitecture='x86' publicKeyToken='1fc8b3b9a1e18e3b' /&gt;
      &lt;/dependentAssembly&gt;
    &lt;/dependency&gt;
    &lt;dependency&gt;
      &lt;dependentAssembly&gt;
        &lt;assemblyIdentity type='win32' name='Microsoft.VC80.DebugCRT' version='8.0.50727.4053' processorArchitecture='x86' publicKeyToken='1fc8b3b9a1e18e3b' /&gt;
      &lt;/dependentAssembly&gt;
    &lt;/dependency&gt;
  &lt;/assembly&gt;
  </code></pre>
  
  <p>It seems to have 2 copies of the <code>Microsoft.VC80.DebugCRT</code> dependent assembly in it.</p>
  
  <p>The <code>8.0.50727.4053</code> 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).</p>
  
  <p>If I remove this assembly from the manifest file, the executable runs fine.</p>
  
  <p>However, when I re-build my application, the manifest is re-generated and the extra dependency is added again.</p>
  
  <p>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.</p>
  
  <p><strong>Update:</strong></p>
  
  <p>I have tried a lot of the suggestions in <a href="http://tedwvc.wordpress.com/2009/08/10/avoiding-problems-with-vc2005-sp1-security-update-kb971090/" rel="nofollow noreferrer">this blog post</a>, 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.</p>