Possible Duplicate:
Get Current .NET CLR version at runtime?
The System.Runtime.Versioning.FrameworkName
class is a strongly typed indicator of a .NET Framework version. It differs based on version number, profile (Client Profile) etc. At runtime, how can you get the FrameworkName
correct for the runtime environment in which the code is being executed? For example, a FrameworkName
corresponding to net40 if you're running in a normal , non-Client Profile setup.
Note - the version of a specific assembly, the version of the compiler used, etc. are not a match here - you might have compiled an assembly with a 2.0 compiler but it may be running in a 4.5 runtime environment.