title: Visual Studio Design/Evaluate/Project-Load MSBuild condition
body: <p>The <code>BuildingInsideVisualStudio</code> <a href="https://docs.microsoft.com/en-us/visualstudio/msbuild/visual-studio-integration-msbuild?view=vs-2015#building-solutions" rel="nofollow noreferrer">MSBuild property</a> allows one to write conditions based on whether a certain build is taking place in visual studio: </p>
  
  <pre><code>&lt;MyProp Condition=" '$(BuildingInsideVisualStudio)' == 'true' "&gt;Foo&lt;/MyProp&gt;
  </code></pre>
  
  <p>However that property is not set during evaluation/design/project-load, so for example in a ccproj something like this doesn't work:</p>
  
  <pre><code>&lt;Foo Condition=" '$(BuildingInsideVisualStudio)' == 'true' "&gt;2.9&lt;/Foo&gt;
  &lt;ProductVersion&gt;$(Foo)&lt;/ProductVersion&gt;
  </code></pre>
  
  <p>Is there a VS evaluation/design/project-load <code>BuildingInsideVisualStudio</code> equivalent?</p>
  
  <p><strong>EDIT</strong>
  Repro steps:</p>
  
  <ol>
  <li>In Visual Studio 2017, create a new <code>Azure Cloud Service</code> project.</li>
  <li>Close the solution in VS and open the <code>ccproj</code> in a text editor and replace the line <code>&lt;ProductVersion&gt;2.9&lt;/ProductVersion&gt;</code> (you might have a different version) with:</li>
  </ol>
  
  <p>.</p>
  
  <pre><code>&lt;Foo Condition=" '$(BuildingInsideVisualStudio)' == 'true' "&gt;2.9&lt;/Foo&gt;
  &lt;Foo Condition=" '$(BuildingInsideVisualStudio)' != 'true' "&gt;9.9&lt;/Foo&gt;
  &lt;ProductVersion&gt;$(Foo)&lt;/ProductVersion&gt;
  </code></pre>
  
  <ol start="3">
  <li>Open the solution in Visual Studio, you will be greeted with the warning: </li>
  </ol>
  
  <blockquote>
    <p>This project is associated with a newer version of the Microsoft Azure
    Tools. You must download the tools and reload the project to continue.</p>
  </blockquote>
  
  <p>In other words, during project load, <code>BuildingInsideVisualStudio</code> has evaluated to false, and so the unsupported 9.9 <code>ProductVersion</code> was resolved.</p>