title: How to detect the runtime/executing .NET Framework version from the application?
body: <p>To be able to investigate an issue reported for one of my apps, I need to know the (runtime) environment in which my application runs on the user's side. Besides application's version and operating system's version, I also want to display the .NET CLR version and (if possible) the .NET Framework version to the user so the user can report these information back to me.</p>
  
  <p>I found several <a href="https://docs.microsoft.com/en-us/dotnet/framework/migration-guide/how-to-determine-which-versions-are-installed?view=netframework-4.7.2" rel="noreferrer">solutions for detecting <em>installed</em> .NET Frameworks</a>, but this is not what I need.</p>
  
  <p>I don't care (at first) what <em>other software</em> is installed on the user's computer. And a .NET Framework installation that is actually not used for running my application is by definition <em>other software</em>, not <em>related software</em>.</p>
  
  <p>To cover the CLR version requirement, I found <code>Environment.Version.ToString()</code> to be usefull.</p>
  
  <p>However, reading the documentation make me anxious. The <a href="https://docs.microsoft.com/en-us/dotnet/api/system.environment.version?redirectedfrom=MSDN&amp;view=netframework-4.7.2#remarks" rel="noreferrer">Remarks section of the Environment.Version documentation</a> points out, that</p>
  
  <blockquote>
    <p>For the .NET Framework 4.5 and later, we do not recommend using the Version property to detect the version of the runtime[...]</p>
  </blockquote>
  
  <p>I understand CLR in something like the API, and the Framework in something like the components and actual logic that can be updated. So knowing the CLR version is a good start, but the Framework version may be also required as it can point out incompatibilities due to bugs in the actual Framework (logic). An error in my application can be a result of a bug in the Framework so there is no bug (but possible workaround potential) in my application. This can drastically speed up the debugging process.</p>
  
  <p>With the remarks about <code>Environment.Version</code> in mind, what can I safely use to get the CLR version for application that runs on .NET Framework version 4.0 up to .NET Framework version 4.7.2?</p>
  
  <p>Is there any way to detect the the .NET Framework version (components and logic) that is used to running my application? Maybe via reflecting the loaded assemblies and take the assembly version from specific assemblies, but is such an approach reliable?</p>