Skip to content

Using VS “Orcas” to Target .Net 3.0 or 3.5

March 15, 2007

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>
To: <TargetFrameworkVersion>v3.0</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…]

From → Tools

3 Comments
  1. Daniel permalink

    Why manually edit the csproj file and not use the project properties window? (see screenshot on my blog)

  2. Rob permalink

    Because the project properties windows don\’t work for me on this build…each tab just has this for content: Microsoft.VisualStudio.Shell.WindowPane.OnCreate()
     
    Your way is much easier though!  I should file a bug to make sure we know this problem…
    Thx, Rob

  3. Daniel permalink

    Ah ok, got you. Sounds like you have VS2005 side by side… The issue is known (again, see my blog for screenshot) :)

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: