views:

144

answers:

4

Hi,

It's possible to develop only for .net 2.0 running Visual Studio 2008?

Thanks!

A: 

Yes, VS2008 supports multi targeting. Check the project properties where you can select the target framweork.

Maurice
+8  A: 

Check out this article - http://weblogs.asp.net/scottgu/archive/2007/06/20/vs-2008-multi-targeting-support.aspx

You might be able to ditch 2005 now...

I still use 2.0 projects in VS 2008 on a weekly basis and it works perfectly.

Joe R
Sigh, unless you have SSIS 2005 packages to edit/author.
Dave Markle
Does this mean that I could work seamlessly with other devs on a 2.0/2005 project, while running VS2008? I really don't have to upgrade the project file? And VS won't encourage me to use language features not available in 2.0sp1? Am I understanding this correctly?
Michael Haren
They would have to use 2008 too - because it will change for example, the web.config...
Joe R
@Michael - no, it upgrades the project file when you open it, so 05/08 aren't compatible in that sense.
GalacticCowboy
Everyone could use 2008 couldn't they?
Joe R
It'd be an easy sell if we could upgrade one at a time vs. 25-50 people all at once. Alas.
Michael Haren
You can have two solutions for the same project, one for 2008 and one for 2005. The only difference as far as I can remember is the version of Visual Studio which goes from 9 to 10 I think.
John_
A: 

Go to the Properties page of your project and click the "Application" tab. Under "Target Framework", you should be able to set the version you want to build for.

Note that the cool thing about VS 2008 is that even if you target to 2.0, you can still use some new language features in C# like "var", etc, even though you aren't using 3.5!

Dave Markle
For more about which features can be used and which can't, see http://csharpindepth.com/Articles/Chapter1/Versions.aspx
Jon Skeet
+7  A: 

Yes, by setting the project property - but be aware that you're really targeting .NET 2.0 SP1 (which is required for .NET 3.5, effectively).

That means if you start using DateTimeOffset (introduced in .NET 2.0SP1) the compiler will think everything is fine and dandy - but if you deploy the app on a vanilla .NET 2.0 box, it won't work.

Jon Skeet
It's possible to use FxCop to help prevent this problem. But it's by no means a guarantee. http://davesbox.com/archive/2008/08/25/new-for-visual-studio-2008-sp1-and-fxcop-1-36-multi-targeting-rule.aspx
JaredPar