MSVC C2859 when using a different build configuration of another project as a library
<p>I have a fairly large multi-project C++ solution in Visual Studio 2015.  Some of the projects compile to static libraries which are used by other projects, and most of them use precompiled headers to speed up compilation.  Each project also has multiple build configurations: debug, release, and several testing configurations which always build an executable to run the tests (even if the normal configurations build a static library).</p>

<p>When building debug and release configurations, or when doing a full rebuild, everything works well, but when doing an incremental build of a test configuration for a project that uses another project's static library, I get C2859 errors which cause the build to fail.</p>

<p>For example, let's say I have a project <code>peach</code> which builds a static library, and a project <code>cobbler</code> that relies on <code>peach</code>.  The precompiled header for <code>cobbler</code> references only system and external libraries (no headers from inside the solution).  <code>cobbler</code>'s <code>test</code> configuration references <code>peach.lib</code>.  <code>peach.lib</code> is created by <code>peach</code>'s <code>release</code> configuration, so I have a <em>solution</em> configuration called <code>cobbler-test</code> which specifies that:</p>

<ul>
<li><code>peach</code> uses its <code>release</code> project configuration</li>
<li><code>cobbler</code> uses its <code>test</code> project configuration.</li>
</ul>

<p>Building <code>cobbler-test</code> from scratch (or rebuilding it, clean &amp; build, etc) works fine.  But if I then modify a source file called <code>crust.cpp</code> in <code>cobbler</code> and try to build, I get this error:</p>

<p><code>c:\...\cobbler\src\crust.cpp(1): error C2859: C:\...\out\cobbler-test.pdb is not the pdb file that was used when this precompiled header was created, recreate the precompiled header.</code></p>

<p>Again, this only happens when referencing a static library from the same solution that was built with a project configuration name different from the current one.  With both projects using <code>release</code> or <code>debug</code>, incremental builds work fine.</p>

<p>Having to do a full rebuild every time defeats the purpose of using precompiled headers in the first place.  Is there any way to get incremental testing configurations to work without having to resort to creating extra project configurations for every combination of projects?</p>