You have two different things:
- What version of the .NET Framework are you targeting? You can set this as the Target Framework in properties.
- What version of the .NET Framework is used when the application is running?
Since some versions are installed in place, even if you target to 4.0 (for example) and 4.5, the application starts using 4.5.
Now what happens in Visual Studio in this case? The answer is that there are reference assemblies for different versions. This way, Visual Studio knows which assemblies, methods, etc. Applicable to the selected target structure and offers only those.
Please note that the application (as I wrote above) can actually work in version 4.5. Thus, although you cannot use the new functions from it directly when targeting 4.0, you can use them through Reflection (but why do this?), And errors and bug fixes that are in version 4.5 but not in 4.0.
source share