Can an application focus on versions 3.5 and 4.5.Net?

I am writing a WPF application that all source code is compatible with .NET 3.5 and 4.5. This means that if I change the .NET target in the properties to either 3.5 or 4.5, this will work fine and work without errors.
Interestingly, in any case, my application file can work on both 3.5 and 4.5.NET (for example: Windows 7 and Windows 8.1), without complie 2 for each .NET? Thanks!

Edit:
When I copy the .NET 3.5 application under Windows 8.1, Windows refuses to run my application and requires the installation of .NET 3.5. So, if it is only compatible with .NET 3.5, it cannot run the application on a .NET 4.5 PC.

+6
source share
2 answers

Build with .NET 3.5 and add these lines to App.config and this worked for me:

 <configuration> <startup> <supportedRuntime version="v4.0" /> <supportedRuntime version="v2.0.50727"/> </startup> </configuration> 
+8
source

you have a target project of 3.5. then add another project to the solution targeting 4.5 and add file links from the first project.

0
source

All Articles