title: MSBuild condition to prevent app.config XML transform
body: <p>I am using the 'SlowCheetah' VS extension to transform our app.config with different values depending on the project configuration. So a 'Debug' configuration produces an app.config with values appropriate for Dev/Qa users, while a 'Release' build produces an app.config with production values.</p>
  
  <p>The .csproj contains a section like this:</p>
  
  <pre><code>&lt;ItemGroup&gt;
  &lt;None Include="App.config"&gt;
    &lt;SubType&gt;Designer&lt;/SubType&gt;
    &lt;TransformOnBuild&gt;true&lt;/TransformOnBuild&gt;
  &lt;/None&gt;
  &lt;None Include="App.Debug.config"&gt;
    &lt;DependentUpon&gt;App.config&lt;/DependentUpon&gt;
    &lt;IsTransformFile&gt;True&lt;/IsTransformFile&gt;
    &lt;SubType&gt;Designer&lt;/SubType&gt;
  &lt;/None&gt;    
  &lt;None Include="App.Release.config"&gt;
    &lt;DependentUpon&gt;App.config&lt;/DependentUpon&gt;
    &lt;IsTransformFile &gt;True&lt;/IsTransformFile&gt;    
  &lt;/None&gt;
  &lt;None Include="packages.config" /&gt;
  &lt;None Include="Properties\SlowCheetah\SlowCheetah.Transforms.targets" /&gt;
  </code></pre>
  
  <p></p>
  
  <p>And the msbuild logic is contained mostly in the 'SlowCheetah.Transforms.targets' file. My files are being transformed correctly.</p>
  
  <p>I want to protect against a developer accidentally running a 'Release' build inside Visual Studio and inadvertently running my app with a production config file. My idea is to use an msbuild condition, possibly something like:</p>
  
  <pre><code>Condition=" '$(BuildingInsideVisualStudio)'=='true' "
  </code></pre>
  
  <p>I've tried using this condition in several places in the .csproj file without success. I suspect I could get this to work if I modify the 'SlowCheetah.Transforms.targets' file itself, but that file should not be modified according to the comments at the top.</p>
  
  <p>Ideally I would like ALL configurations for builds inside Visual Studio to use my Debug config file, and 'Release' builds outside Visual Studio (such as builds on a continuous integration server) to use the Prod app.config, but I'd settle for being able to prevent accidental running of a 'Release' build inside Visual Studio. Any suggestions as to if/how this can be achieved are appreciated. </p>