title: How to find out where VCTargetsPath value in Visual Studio 2012 comes from?
body: <p>This question was asked many times, but previous answers didn't help me, or I did something wrong.</p>
  
  <p>Anyhow, I have a Visual Studio 2012 solution, which primarily consists of .NET projects, but there is a couple VC++ projects, which fail to load whenever I open the solution. The error for every VC++ project in 'Solution' output is:</p>
  
  <blockquote>
    <p>D:\folder\SomeProject.vcxproj : error  : Unable to read the project
    file "SomeProject.vcxproj". D:\folder\SomeProject.vcxproj(102,3): The
    imported project "C:\Microsoft.Cpp.props" was not found. Confirm that
    the path in the  declaration is correct, and that the file
    exists on disk.</p>
  </blockquote>
  
  <p>The project itself uses <code>$(VCTargetsPath)</code> macro to resolve the folder, but it fails for some reason. I tried several solutions, including updating registry and setting environment variables. The only notable change was when I set <code>VCTargetsPath</code> environment variable to a valid folder, like <code>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V110</code> in my case. After reloading a solution I got the following output:</p>
  
  <blockquote>
    <p>D:\folder\SomeProject.vcxproj : error  : Unable to read the project
    file "SomeProject.vcxproj". D:\folder\SomeProject.vcxproj(102,3): The
    imported project "<strong>D</strong>:\Microsoft.Cpp.props" was not found. Confirm that
    the path in the  declaration is correct, and that the file
    exists on disk.</p>
  </blockquote>
  
  <p>I tried running VS repair from the control panel, but it didn't help. I can't reinstall Visual Studio at the moment, because I don't have access to the installation files our company uses. The only working workaround I came up with is building with MSBuild from CLI and setting VCTargetsPath there, like this:</p>
  
  <pre><code>$TargetsPath = 'C:\Program%20Files%20(x86)\MSBuild\Microsoft.Cpp\v4.0\v110\'
  msbuild /v:$Verbosity /m /t:$Target /P:Configuration=$Configuration /P:VCTargetsPath=$TargetsPath /P:TreatWarningsAsErrors=false "$($Solution.FullName)"
  </code></pre>
  
  <p>And solution builds just fine. However, I do need a properly loaded into VS solution, so this workaround solves only some of my problems.</p>
  
  <p>Finally, my question, I guess, would be how to set or override <code>VCTargetsPath</code> macro in a Visual Studio 2012 environment? Or how to find out where this macro value is coming from? I'm using Visual Studio 2012 - version 11.0 Update 5.</p>