title: Building the same solution using msbuild and devenv interchangeably
body: <p>It so happens quite often that I start by building some solution on the command line using msbuild, run it for awhile, but then discover that I need to change and debug it. So, I open it in Visual Studio and end up building it inside the Visual Studio.</p>
  
  <p>What happens is that VS rebuilts quite a few parts of the solution, even when I change nothing!</p>
  
  <p>Digging into it reveals the following:</p>
  
  <p><strong>Building inside Visual Studio generates empty cs files and injects them into the <code>Compile</code> item group.</strong> Naturally, they are newer than the already built binaries and so devenv.exe rebuilds an awful lot of projects. Thanks to <a href="https://stackoverflow.com/questions/12405619/temporarygeneratedfile-guid-in-obj-debug-breaking-build/15038994#15038994">TemporaryGeneratedFile_[guid] in /obj/debug breaking build</a></p>
  
  <p>This is a real bummer. I disabled this behavior by renaming the <code>Microsoft.WorkflowBuildExtensions.targets</code> file - I do not do workflow. </p>
  
  <p>I suppose I could hack into <code>CoreCompileDependsOn</code> and somehow neutralize the <code>GenerateCompiledExpressionsTempFile</code> target from Microsoft.WorkflowBuildExtensions.targets, but this has to be done in 190 projects! This is a serious change.</p>
  
  <p><strong>devenv.exe seems to care about some files always being copied to the output directory</strong>, even if msbuild does not think it is a problem.</p>
  
  <p>Indeed, here is a line from the devenv.exe build log:</p>
  
  <pre><code>Project 'HRCore.Tests' is not up to date. Project item 'C:\abc\UI\HRCore.Tests\HRImport\Import_missing_state_county.xml' has 'Copy to Output Directory' attribute set to 'Copy always'.
  </code></pre>
  
  <p>So what? msbuild does not care about it, but devenv does. This files is not a dependency of the <code>HRCore.Tests</code> and msbuild got it right. </p>
  
  <p>In the meantime I changed it from <code>Always</code> to <code>PreserveNewest</code>.</p>
  
  <p>Anyway, I am interested to know how can I eliminate these differences.</p>
  
  <p>For example, is it a good idea to set <code>BuildingInsideVisualStudio</code> to <code>true</code> even when building with msbuild?</p>
  
  <p>Any ideas?</p>
  
  <p>P.S.</p>
  
  <p>We build both .NET and Silverlight. Console applications, dlls and web applications.</p>