views:

693

answers:

7

I have VS2005. How can I compile my project under specific version of .NET? I have installed 1.0, 2.0, 3.0 & 3.5. Tnx in advance.

+4  A: 

You can't I'm afraid. VS2005 only works with .NET framework 2.0. You'll need the appropriate versions of Visual Studio to work with other versions:

  • 1.0: Visual Studio .NET
  • 1.1: Visual Studio .NET 2003
  • 2.0: Visual Studio 2005 / 2008
  • 3.0 / 3.5: Visual Studio 2008
  • 4.0: Visual Studio 2010

jmservera points out that some 3.0 libraries are compatible with Visual Studio 2005. For example WCF is compatible, while LINQ isn't. Some of these require additional downloads, for example to use Windows Workflow Foundation comfortably in Visual Studio 2005, you need to install this extension.

Ant
+1 for writing the same that I wanted just a little bit faster. However, for the record, you could add Visual Studio 2010 to the list for 2.0, 3.0, 3.5 and 4.0.
OregonGhost
The 3.0 libraries are compatible with VS2005, for example: you can use WCF in 2005, but not LINQ
jmservera
2 good points - beaten to the first edit by Kirtan, but I'll add your comment jmservera... thanks!
Ant
Tnx for such rapid answer!!!!
joycollector
no probs - glad to have helped :)
Ant
As far as I know, didn't VS2008 had an option to change the framework version?
MaLKaV_eS
Yeah - that's why I've listed it in several framework versions. Kirtan's answer shows that below...
Ant
+4  A: 
Kirtan
Actually Just so everyone is aware, this does not restrict you at all it seems. We just figured that out when our app which has a target of 2.0 got Linq and some other 3.5 specific things added, and the compiler didn't squak at all.
Alex
Hi Alex, just read this post - http://weblogs.asp.net/scottgu/archive/2009/08/27/multi-targeting-support-vs-2010-and-net-4-series.aspx - and according to it - "Intellisense within VS 2008 always shows the types and members for the .NET 3.5 version of a framework library (even if you are targeting .NET 2.0). This means that you can sometimes inadvertently end up using a method that is only in ASP.NET 3.5 even when you are working on a ASP.NET 2.0 project."
Kirtan
A: 

VS2005 has no support for 1.0,1.1 and 3.5, you only would be able to compile from 2.0 up to 3.0. 3.0 are only new libraries added to 2.0 so you only have to add the references.

jmservera
A: 

When you compile a project it will look at the project Target Framework in the project properties. You can only compile .net items against certain versions of VS

AutomatedTester
A: 

I think you can do that if you use the SharpDevelop IDE, which is free, and really similar to Visual Studio. http://www.icsharpcode.net/OpenSource/SD

yeyeyerman
A: 

Visual 2008 allow you to choose a specific version of the framework in the project properties.

In Visual 2005, by default, projects use v2.0 but you can build 3.5 projects to using templates (WPF application, WCF, ....)

rockeye
A: 

I believe it is possible with MSBuild:

http://social.msdn.microsoft.com/forums/en-US/msbuild/thread/6043542c-6946-488c-b5f4-960eaed7a9f4/

On a side note, I use VS 2008 and when I view the Properties for a project, I get the option to build for 3 different target frameworks: .NET 2.0, 3.0 and 3.5

AdaTheDev