title: Conditionally changing target framework version
body: <p>I'm trying to compile an #ifdef'd codebase to two different target frameworks, namely 3.5 and 4.0.</p>
  
  <p>I attempted to modify the .proj files in the solution to no avail.</p>
  
  <p>It seems MSBuild / VS2012 isn't picking up the solution configuration change via UI.</p>
  
  <p>This is a fragment of one of the .proj files:</p>
  
  <pre><code>  &lt;PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "&gt;
      &lt;DebugType&gt;pdbonly&lt;/DebugType&gt;
      &lt;Optimize&gt;true&lt;/Optimize&gt;
      &lt;OutputPath&gt;..\Binaries\&lt;/OutputPath&gt;
      &lt;DefineConstants&gt;TRACE;NET35&lt;/DefineConstants&gt;
      &lt;ErrorReport&gt;prompt&lt;/ErrorReport&gt;
      &lt;WarningLevel&gt;4&lt;/WarningLevel&gt;
      &lt;TargetFrameworkVersion&gt;v3.5&lt;/TargetFrameworkVersion&gt;
    &lt;/PropertyGroup&gt;
    &lt;PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug 40|AnyCPU' "&gt;
      &lt;DebugSymbols&gt;true&lt;/DebugSymbols&gt;
      &lt;OutputPath&gt;..\Binaries\&lt;/OutputPath&gt;
      &lt;DefineConstants&gt;TRACE;DEBUG;NET40&lt;/DefineConstants&gt;
      &lt;DebugType&gt;full&lt;/DebugType&gt;
      &lt;PlatformTarget&gt;AnyCPU&lt;/PlatformTarget&gt;
      &lt;ErrorReport&gt;prompt&lt;/ErrorReport&gt;
      &lt;CodeAnalysisRuleSet&gt;MinimumRecommendedRules.ruleset&lt;/CodeAnalysisRuleSet&gt;
      &lt;TargetFrameworkVersion&gt;v4.0&lt;/TargetFrameworkVersion&gt;
    &lt;/PropertyGroup&gt;
  </code></pre>
  
  <p>When I switch to "Debug 40" from "Release" the target framework does not change in the project properties (thus breaking the compilation because of other conditionally referenced assemblies).</p>
  
  <p>I'm also having problems conditionally referencing different assemblies, as if, again, the solution configuration isn't picked up by VS/MSBuild (some don't even show up in the references).</p>
  
  <p>Edit: I'm excluding Microsoft.CSharp from the v3.5 build with the following line:</p>
  
  <pre><code>&lt;Reference Include="Microsoft.CSharp" Condition=" '$(Configuration)' == 'Debug 40'" /&gt;
  </code></pre>
  
  <p>So far it seems it's just the TargetFrameworkVersion property that is ignored.</p>