title: How to get the version of the .NET Framework being targeted?
body: <p>How can i get the version of the .NET Framework i am targeting, rather than the version of the .NET framework the app is currently running under?</p>
  
  <p>For example, if the application targets .NET Framework 4.5, i would need to know that i am targeting .NET Framework 4.5.</p>
  
  <p>For example, checking <code>System.Environment.Version</code>:</p>
  
  <ul>
  <li>when targeting .NET Framework 4: <code>4.0.30319.18502</code></li>
  <li>when targeting .NET Framework 4.5: <code>4.0.30319.18502</code></li>
  </ul>
  
  <p>So that doesn't work.</p>
  
  <p>The real goal is to try to work around the <a href="https://stackoverflow.com/questions/19084981/how-to-define-away-code-based-on-net-framework-version/19085317">lack of compiler defines in .NET</a>.</p>