title: When and why do I need the supportedRuntime element and sku attribute?
body: <p>In most (if not all) C# (and F# and VB) library and executable projects created in Visual Studio there is an automatically added <code>app.config</code> file that specifies runtime version and target framework moniker (TFM):</p>
  
  <pre><code>&lt;configuration&gt;
    &lt;startup&gt;
      &lt;supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0" /&gt;
  . . .
  </code></pre>
  
  <p>Even absent the <code>app.config</code> file entirely, the compiler seems to always generate an assembly-level attribute, as ILDASM shows:</p>
  
  <pre><code>.custom instance void [mscorlib]System.Runtime.Versioning.TargetFrameworkAttribute::.ctor(string) = ( 01    // ....NETFramework
                                                                                                        ..    // ,Version=v4.6.1.
                                                                                        bytes snipped-&gt; ..    // .T..FrameworkDis
                                                                                                        ..    // playName..NET Fr
                                                                                                        61  ) // amework 4.6.1
  </code></pre>
  
  <p>The <code>.csproj</code> file does specify the target frameworks, and my guess this is where the target is passed from on to the compiler during build.</p>
  
  <p>The executable seems to run just fine without the <code>&lt;startup&gt;</code> section in the config file. <a href="https://docs.microsoft.com/en-us/dotnet/framework/configure-apps/file-schema/startup/supportedruntime-element" rel="noreferrer">The documentation</a> explains <em>what</em> do the attributes mean, but, seeing them for many years, I never understood <em>why</em> they are needed in the configuration file. I mostly dealt with desktop applications for Windows, however.</p>
  
  <p><a href="https://stackoverflow.com/a/38036555/1149924">This answer</a> explicitly states that “making a program compiled to target .NET 4.0 behave like it runs on a higher version is not possible,” and I would be really surprised if, conversely, running a program on a lower version of the framework were also possible.</p>
  
  <p>So, under what scenarios does the application developer need to specify the version and TFM of the runtime in the <code>.config</code> file of the application, and does it have to always duplicate information that is hardcoded into the binary by the compiler? The requirement seems counterintuitive at first sight.</p>
  
  <hr>
  
  <p>UPDATE 2018-06-29: X-ref: I asked for a clarification of the documentation in the GitHub issue <a href="https://github.com/dotnet/docs/issues/6234" rel="noreferrer">dotnet/docs#6234</a>.</p>