title: Override One Property in a .targets file
body: <p><strong>Background:</strong> I have several solutions with roughly 300 C++ projects across them, most of them shared. We are using Visual Studio 2013 and have a build script that compiles all of the projects in the correct order, ensuring dependencies are resolved ahead of time. Our development/engineering team builds all of the code through the build script and then attempts to debug using Visual Studio 2013.</p>
  
  <p><strong>Issue:</strong> The "build then debug" process results in Visual Studio telling us that the Projects are out of date. This stems from the ProjectEvaluationFingerprint property (in Line 39 Microsoft.CppBuild.targets) including a <code>$(SolutionDir)</code> in the output file. The <a href="https://connect.microsoft.com/VisualStudio/feedback/details/772826/projects-just-built-in-another-solution-are-out-of-date" rel="nofollow noreferrer">recommended fix from Microsoft</a> suggests removing the <code>$(SolutionDir)</code> from the file. As our developers tends to transition back and forth between projects, I do not want to manually change this .targets file on every developer's machine (and remember to change it back when they leave the project). I would like to override the property in the .vcxproj by using a .targets file explicitly for this.</p>
  
  <p>The property in Microsoft.CppBuild.targets looks like:</p>
  
  <pre><code>&lt;!-- Global up-to-date check support --&gt;
  &lt;PropertyGroup&gt;
     &lt;ProjectEvaluationFingerprint&gt;$(Configuration)|$(Platform)|$(SolutionDir)|$(ProjectEvaluationFingerprint)&lt;/ProjectEvaluationFingerprint&gt;
  &lt;/PropertyGroup&gt;
  </code></pre>
  
  <p>Generally, I have been following Microsoft's <a href="https://msdn.microsoft.com/en-us/library/ms171464.aspx" rel="nofollow noreferrer">How to: Use the Same Target in Multiple Project Files</a>.  I have created a .targets file (<code>test.targets</code>) that contains the following code (<em>note the TEST text was to test evaluation of the property in both the build script and building the project in Visual Studio</em>):</p>
  
  <pre><code>&lt;Project ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"&gt;
  &lt;PropertyGroup&gt;
      &lt;ProjectEvaluationFingerprint&gt;$(Configuration)|$(Platform)|TEST|$(ProjectEvaluationFingerprint)&lt;/ProjectEvaluationFingerprint&gt;
  &lt;/PropertyGroup&gt;
  </code></pre>
  
  <p>I then import it using the following line in the .vcxproj </p>
  
  <pre><code>&lt;Import Project="..\..\Config\VSPropertySheets\test.targets" /&gt;
  </code></pre>
  
  <p>The project.lastbuildstate file now reads:</p>
  
  <pre><code>#TargetFrameworkVersion=v4.0:PlatformToolSet=v120_xp:EnableManagedIncrementalBuild=false:VCToolArchitecture=Native32Bit
  Debug|Win32|D:\views\devbranch\Products\SLN\|Debug|Win32|TEST|
  </code></pre>
  
  <p>It is appending the new ProjectEvaluationFingerprint to the existing one, so it is not overriding (I can understand this to a degree, but I'm no MSBuild expert).</p>
  
  <p><strong>Question:</strong> How can I override this one property using a .targets file? Do I need to use a <a href="https://stackoverflow.com/questions/15406712/override-one-value-in-properties-file">replaceregexp  task</a> or do I have an easier option?</p>