Using VS “Orcas” to Target .Net 3.0 or 3.5
I’m using VS "Orcas" March 2007 CTP for almost all of my development now. As I learn things about it, I’ll post them…
It has worked fine for me side by side with VS2005 (i have sp1 + vista support installed), but there are dire warnings that it shouldn’t be used on a production machine, so I would be careful…my machine is very pavable, even though I’d prefer not to do it. I think I read a blog that the 9-part install has a side-by-side issue involving sql, while the 7 part download and install didn’t include sql, and thus it didn’t seem to have problems. There is also a VirtualPC version of this available, I believe. Be careful…
Before you go on
Daniel Moth left great info in a comment see his post for the easy way…if it doesn’t work on your machine, as on mine, see below for the manual way. Thanks Daniel.
Creating new Projects
Under File/New Project, the VS team has made available "WPF Application", "WPF Browser Application", and "WPF User Control Library". They have renamed winforms apps from "Windows Application" to "Windows Form Application".
You have a choice of Targetting .Net3.5 or .Net3.0. It defaults to 3.5. There is a menu that is a bit difficult to find, where you can change your framework version before you create the project. Choices include 2.0, 3.0, and 3.5.
I haven’t looked at all the differences of the project files that are created, but the main thing is the reference assemblies differ for those different target versions.
.Net 2.0: references only .net 2.0 assemblies (wpf not possible here)
.Net 3.0: references only .net 3.0 assemblies (linq not possible here)
.Net 3.5: references all of .net 3.0 and adds System.Core.dll (where linq is)
It seems like the new project dialog remembers the last framework version you used and keeps that setting.
How do I convert a 3.5 project to 3.0
The first time I created a project, i created a 3.5 project. Since I want to publish targeting existing Vista users (and xp users with .net 3.0), I wanted to go back and change it.
I did the following:
1) opened each project file in my solution. Right click/Unload Project. Right click/Edit MyApp.*proj. Changed: <TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
Right click/Reload Project.
The System.Core.dll reference is now a warning…since it can’t find it.
My guess is the Microsoft.Common.targets (part of the msbuild system that is controlled by your project file settings) switches the framework directory it searches for referenced assemblies from c:\windows\microsoft.net\v3.5.20212 to c:\windows\microsoft.net\v3.0, so System.Core.dll wasn’t found.
Each .cs has a "using System.Linq;", which will raise errors now…remove that line.
New Category for Posts: "WPF Tools"
This post was my first under a new category: WPF Tools. I’ll go back and change a few posts to this category name…]