I have an VB.net application where the supportedRuntime is mentioned as <supportedRuntime version="v4.0"/><supportedRuntime version="v2.0.50727"/>
in config file.
According to Microsoft Link on computer with version 4 or later versions installed application runs on 4 or later versions.
I have got Environment.Version
that gives the CLR version but have a warning mentioned as "For the .NET Framework 4.5 and later, we do not recommend using the Version property to detect the version of the runtime" link
When I use Environment.Version
I get "4.0.30319.42000". According to
microsoft link suggests For .NET Framework 4.6 and later versions, it has the form 4.0.30319.42000
.
Is there any way to know the exact version of the .NET Framework the application will target on runtime if multiple versions of .NET Framework 4 and above is installed.
Also RuntimeInformation.FrameworkDescription
Property gets the name of the .NET installation on which an app is running but requires .NET Framework 4.7.1, 4.7.2, 4.8, 4.8.1.
So I want to know any other method that will work irrespective of the framework version.