How to decide what is the .Net target
We now use VS2003 (target to .Net 1.1) and we want to upgrade to VS2008, but I wonder what should be the new .Net target?
Should I leave the target as .Net 1.1 (very old, not installed on all computers) or upgrade it?
If I upgrade - Is 2.0 enouth? or maybe upgrade to the latest 3.5 (our clients use Windows XP, Vista and Windows 7)
What happens if I target my app to 2.0, and the user has 3.5? should the user install .Net 2.0 on .Net 3.5? can it work side by side even when installing old version "above" new version? or maybe the application would work without errors and warnings because 3.5 "includes" 2.0?
Thanks,
Atara
. . .
Thank you all. I guess I am going to target to 2.0, to cover most of my clients, and if a client does not have any .Net installed, I will ask him to inst开发者_如何学编程all the latests (3.5 and later 4)
Can you please just confirm that .Net 3.5 just added more assemblies to 2.0, and does not include bug-fixes for 2.0 assemblies ?
(The computer skill level of my users is not high, Less installation is better)
. . . Update: See my problem - Microsoft .NET compatibility
Thank you for answering.
Atara
You cannot target 1.1 with VS2008 so scratch that option. There are no real differences between 2.0, 3.0 and 3.5, they all use the same version of the CLR. Versions 3.0 and 3.5 just added more assemblies. Notably those that support WPF, WCF and Linq.
If you are not interested in using these new features then targeting 2.0 will work just fine. And your program will run without problems if the target machine has any version of .NET equal or greater than 2.0 installed.
Finding out that you might accidentally uses a class that's only available in a later version is easy enough, you simply can't add the assembly reference when you use Project + Add Reference. The later ones will be grayed out in the list. It is also well documented in the MSDN Library, the framework version the class is available in is listed at the bottom of the page.
Yet one more option: if you have a lot of customers still on XP that don't have .NET installed yet then you might want to consider checking the "Client-only Framework subset". This cuts down the assemblies you can reference to the core ones, the associated Client Framework install is a very lean 28 MB.
Quick clarification, if you upgrade to VS2008 you cannot target any of the 1.X frameworks. VS2008 only supports targeting 2.0, 3.0 and the 3.5 frameworks.
One thing you need to consider when targeting a framework is the impact on your customers. To use your application, the target customer will need to also have the corresponding .Net framework installed on their machine. The cost of doing this can vary a bit depending on the scenario. The best case though is the .Net framework is already installed and hence the user can just install your application.
- 1.X: Comes pre-installed on W2K3
- 2.0: Pre-installed on Windows Vista, W2K8 and Win7
- 2.0SP1: Pre-installed on Win7 (maybe W2k8)
- 3.5: Win7 (maybe W2K8)
My personal choice would be to use the 2.0 framework unless your application actually uses a feature from the 3.5 or higher framework. This increases the chance the end user will already have the .Net framework installed on their machine and hence reduces the cost of installing your application.
For the last part, if the customer has a higher version of the .Net framework then your application will work just fine.
I would target 3.5, most installations ans service packs now install it by default so you should be OK. If you target 2.0 and the user has 3.5 nothing really happens, it is perfectly supported.
If you haven't upgraded since VS2003, and are about to upgrade now - consider waiting less than 6 months, to get VS2010 instead. There are several benefits:
- You can still target .NET 2.0/3.5, but you also have .NET 4.0 available whenever you decide you want it.
- For new projects, you can start working with an upgrade to 4.0 in mind, and instead of being hopelessly behind (as you, no offence, are now... and will be quite soon if staying with VS2008) you can be front edge.
- Since there is a public beta out there, you can let your developers start getting used to the new environment already, if you want to. I'm no lawyer, but as far as I've understood there's no legal limitation to using the beta in commercial production - except that since it's a beta, MS disclaim all liability for stability etc. It works really well though...
- Another effect of the public beta is that there are lots of articles, screen casts and blog posts on the new features in .NET 4, and how to utilize them. Most newly published material targets VS2010, and soon nothing (or very little) new will be written for an audience of VS2008 programmers.
.Net 3.5 SP1 is installed by default on Windows 7, Windows Vista has 3.0 installed.
If your going to convert the app to WPF, Target 3.5.
If your going to use LINQ or Lambda expressions use at least 3.0
2.0 should be on all machines by now. Most users should have 3.5 since it's pushed with windows update.
I would hold off on 4.0 (when it's released), but if that is a must, target 4.0 client, since it's only 30mb or so.
Requiring a framework the user does not have installed is an annoyance to them. Make sure your deployment solution will detect .Net and if they don't have it, install 3.5 sp1 on the machine (even if you target 2.0 and they don't have 2.0).
Moving from 1.1 to 2.0 is a big step since you will need to rewrite or change a few things in your code, mostly due to obsolete methods and such.
After using VS 2010 Beta 2 has my primary IDE, I can't go back to using 2008. 2010 is a big improvement, so would 2003 > 2008.
For your current situation, target 2.0, but later on target 3.0 or 3.5 and use lambda's (resharper can help optimize your code!)
精彩评论