1

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.

P.S. 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.

Community
  • 1
  • 1
SolessChong
  • 3,370
  • 8
  • 40
  • 67

2 Answers2

1

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

Community
  • 1
  • 1
danielovich
  • 9,217
  • 7
  • 26
  • 28
  • The only reason i can think of to not use 4.0 is that the likely hood of the user having to download the framework is less. But these days most people have 4.0 installed and its only a 48mb download. – string.Empty Apr 18 '13 at 11:23
  • @NicolasTyler That's it. I'm trying to make a light-weighted desktop software. – SolessChong Apr 18 '13 at 11:40
  • @danielovich Hi thanks for answering. I'm not to release with the framework since I'm trying to build a light-weighted software. A 50mb package is too large for my software. – SolessChong Apr 18 '13 at 11:42
  • 2
    Well frameworks 2.0 is 30mb. But as i said before the chances are higher that a user will have frameworks 2.0 installed already. I get where you are coming from but i wouldn't use 2.0, maybe go with 3.0 or 3.5. – string.Empty Apr 18 '13 at 12:20
1

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.

Andy
  • 8,432
  • 6
  • 38
  • 76