I write a WPF app, that all source code compatible with both .NET 3.5 and 4.5. That mean if I change .NET target in the Properties to either 3.5 or 4.5, it will complie and run well without any error.
I wonder there is anyway to my my app file can run on both 3.5 and 4.5 .NET pc (example: Windows 7 and Windows 8.1), without complie 2 version for each .NET? Thank!
Edit:
When I copy the .NET 3.5 application in question to a Windows 8.1 pc, Windows refuse to run my app, and require I install .NET 3.5. So if only complie with .NET 3.5, it dont make app can run in .NET 4.5 pc.
Build with .NET 3.5 and add these lines to App.config
and it worked for me:
<configuration>
<startup>
<supportedRuntime version="v4.0" />
<supportedRuntime version="v2.0.50727"/>
</startup>
</configuration>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With