简体   繁体   中英

Compatible with both dotnet 3.5 and dotnet 4.0

Originally it is set to use .Net3.5 for compatibility with win7. (Actually using WPF)

However when it comes to users in win8 which supports only the .Net4.0, it is required for users to download and install .Net3.5, which results in a terrible user experience.

Here comes my question:

How to make a software compatible with multiple .Net versions?

Actually I tried to use .Net 2.0 for the software and it goes well with both win7 and win8. However when it comes to .Net 3.5, the backward compatibility seems to be awful. However I really need some features available in 3.5, or WPF.

I don't mind if I have to build multiple binary releases, provided a auto-selection mechanism is available.

PS I've found a similar question at Make same app compatible for Net3.5 & 4.0@stackoverflow but got no help after reading it.

Edit

I'm using both winform and WPF. I'm using WPF for a better looking UI, however, as is nutoriously know, the webbrowser in WPF cannot render in a WPF app. So I use a winform webbrowser.

Make sure you don't use types that are not included in the lowest version you target!

.NET 2, 3 and 3.5 all share the same CLR, which should have the same effect on your code and expected outcome. 3.0 and 3.5 has different types as well, so watch out for that.

.NET 4.0 has a different CLR and your code might not act 100% in the same way as with the CLR 2.0.

But, why not ship with the redistributable 4.0 framework. It works on XP sp3, Vista sp1 , 7 and 8. Distributing .NET 4.0 redistributable with application

If you're making an normal WPF desktop application, just move your target framework to .Net 4 and be done with it. .Net 4 is fully supported on Windows 7 as well as Windows 8. If you don't want to have the users download an install .Net 4, include it in your setup distribution.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM