title: When executing an application on .net 4.0, compiled under .net 2.0
body: <p>Assuming that:</p>
  
  <ol>
  <li>The C# source code below is compiled under .NET 2.0 (CLR 2.0); and</li>
  <li>The above application uses the <code>app.config</code> listed below; and</li>
  <li>Only .NET 4.0 (CLR 4.0) is installed on the environment of the client executing the application,</li>
  </ol>
  
  <p>then which version of .NET is internally loaded to execute the application on the client's environment?</p>
  
  <h2>Description</h2>
  
  <p>The console application below will simply show that its CLR version is <code>v4.0.30319</code> in the console, but @Reed Copsey's answer of the stack (<a href="https://stackoverflow.com/questions/4685345/clr-2-0-vs-4-0-performance">CLR 2.0 vs 4.0 performance?</a>) shows that .NET 2.0 is loaded in this case. Moreover, at <a href="http://msdn.microsoft.com/en-us/library/bbx34a2h.aspx" rel="nofollow noreferrer">MSDN</a> it says when <code>useLegacyV2RuntimeActivationPolicy</code> is set to false <code>false</code>:</p>
  
  <blockquote>
    <p>Use the default activation policy for the .NET Framework 4 and later,
    <strong>which is to allow legacy runtime activation techniques to load CLR
    version 1.1 or 2.0 into the process.</strong></p>
  </blockquote>
  
  <p>It sounds like .NET 2.0 is loaded in spite of the <code>app.config</code> having a .NET 4.0 configuration. Have I misunderstood anything?</p>
  
  <h2>Source</h2>
  
  <p><strong>C# source code</strong></p>
  
  <pre><code>namespace ConsoleApplication1
  {
      class Program
      {
          static void Main(string[] args)
          {
              string version = Environment.Version.ToString();
              Console.WriteLine(version);
          }
      }
  }
  </code></pre>
  
  <p><strong><code>app.config</code></strong></p>
  
  <pre><code>&lt;?xml version="1.0"?&gt;
  &lt;configuration&gt;
      &lt;startup useLegacyV2RuntimeActivationPolicy="false"&gt;
          &lt;supportedRuntime version="v4.0.30319"/&gt;
      &lt;/startup&gt;
  &lt;/configuration&gt;
  </code></pre>