views:

86

answers:

2

I'm new in the .NET-world. I just built my first application with .NET-versionn 4.0 and am wondering if its a wise choice to lower the target-framework as much as possible (to 3.0 maybe) if it still works then.

Whats best-practice when it comes to choosing the appropriate .NET-version?

+1  A: 

Choosing the framework version to support is mainly a question of your target user group.

  • If you are developing a tool for a corporate environment, you might be limited by the framework version that the default configuration of the corporation supports (which sometimes might be a version or two behind the latest version) - or you are lucky and the IT department is willing to upgrade their platform to the latest version.

  • If you are targeting home users you should consider that not everyone is already having the latest framework version installed, and not every user is willing to download and install a new version just to use your tool. So you need to consider if you can allow to ignore such users or not.

Of course, you can always include the latest version with your setup, but don't forget that the framework installation requires administrative rights.

0xA3
+2  A: 

If you are targeting Windows desktop users, you can be pretty confident they have at least .NET 2.0 and probably higher. It is unlikely they will have .NET 4 though. Unless you know the audience (eg. a business customer), choosing .NET 4 will likely limit your reach at this point.

.NET 4 introduces the first real platform change in a while in that it is built on the CLR (Common Language Runtime) version 4. Before that, .NET 2.0, 3.0, and 3.5 all ran on version 2 of the CLR.

The only difference between .NET 2.0, 3.0, and 3.5 are the in the framework (the libraries). Most of the libraries are unchanged but new libraries where added with each version. It depends what libraries you use. If you include all the libraries you need in your application then you can run anything that .NET 3.5 can do on .NET 2.0.

If you need a legal way of distributing .NET 3.5 era libraries to a .NET 2.0 audience, one option is shipping some assemblies from the Mono Project.

For example, you might find that the only .NET 3.5 assembly you need is System.Core.dll. If you include the Mono version of System.Core.dll with your application, it will run just fine on .NET 2.0 and up even though you are using ".NET 3.5" features (like LINQ for example).

If you are using ASP.NET then it really does not matter what they have as you are just feeding them HTML.

EDIT: I was not aware that Windows Presentation Foundation (WPF) required a service to be running. I have used Mono to add .NET 3.5 features to .NET 2.0 apps but I have not used WPF.

You cannot get the WPF assemblies from anywhere but Microsoft though so you cannot redistribute those anyway. Mono projects tend to use GTK# for the GUI although Windows Forms is also available cross-platform.

Justin
"If you include all the libraries you need in your application then you can run anything that .NET 3.5 can do on .NET 2.0": Unfortunately it is not that easy. It might work with some assemblies but that is just pure luck. In general you will have to run the .NET Framework installer to get everything set up correctly. E.g. to use WPF you will have to have a service running.
0xA3