11
votes

I have a .NET 2.0 application and I plan to make a 'smart installer' which checks for the available .NET version on the user's PC and install my specific port for it. I saw that:

  • Windows XP (SP2) comes with .NET 2.0
  • Windows Vista comes with .NET 3.0
  • Windows 7 comes with .NET 3.5
  • Windows 8 comes with .NET 4.5

As far as I know, the only thing that's not backward compatible is the CLR version, which is changed after .NET 4.0.

So if I don't want the user to install additional framework just for my application, I should have these versions of my app:

  • .NET 2.0 - XP (SP2 and upper), Vista (3.0 should be able to run 2.0) and 7 (3.5 should be able to run 2.0)
  • .NET 4.0 - if someone installed 4.0 ONLY and have no other
  • .NET 4.5 - for the users that have Windows 8 with no other .NET installed

Am I right? Or 4.5/4.0 are backward compatible?

EDIT: If any of the upper data isn't right, please correct me

2
Urgh. You are going to create a different version of your application for each and every version of .NET that is available? Seems like a lot of wasted time and coding effort. Why not just pick the lowest common denominator?KingCronus
I won't change a single line, just recompile for 3 different versions. My web installer will pick which one to install.blez
So you won't be using any .NET 3/3.5/4+ features at all. You might as well just have a single .NET 2 version in my opinion? What is your reasoning for not wanting the user to have to install a framework? It seems perfectly reasonable in my opinion.KingCronus
I personally don't like forcing users to install frameworks just for a single app. That's one of the reasons I don't like Java and I like .NET. That's why I will make my software not requiring additional installs.blez

2 Answers

11
votes

As far as I know, the only thing that's not backward compatible is the CLR version, which is changed after .NET 4.0.

This isnt true. You can make your .NET2 compiled application run on the .NET4 framework.

You just need to add the following to your app.config:

<configuration>
<startup>
    <supportedRuntime version="v2.0.50727"/>
    <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0,Profile=Client"/>
    <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/>
  </startup>
</configuration>

Note, I agree with @KingKronus, ie Why not just pick the lowest common denominator?

In your case that would be .NET2 compiled and only one set of pdbs and one compilation set.

Yes, you would need to test your .NET2-compiled app runs OK on the .net4 runtime BUT you would need to test your app in each of the frameworks in your original solution anyway.

0
votes
  1. Actually you don't need to check it manually. Your application will show proper message after you run it and ask user to download and install the needed version.

  2. If you still need to support windows XP, choose .NET 4.0. .NET 4.5 will handle it