views:

99

answers:

4

I have VS2005 and VS2008 installed on my pc.

I have .NET Framework 2.0 SP2, 3.0, 3.0 SP2, and 3.5 SP1

I am able to selection which Framework to use in VS 2008 from the drop down window, but I'm curious how I set which framework I want to target a project for in VS 2005. I obviously dont want to uninstall frameworks because I would still like to use VS 2008 for various target frameworks.

What I'm trying to accomplish is using VS2005 but only using available assemblies from 2.0. But at the same time use VS2008 and whatever framework I want.

I tried looking for the answer already on SO, so if its a dup, just point me to the link. Thanks

EDIT: Ok, based on what other people are mentioning and me digging a little deeper, it looks like it might be a specific version of the 2.0 framework. I'm looking at the WaitHandle WaitOne function, and it was causing our appliation to crash on the customers PC's who claimed they had 2.0 installed. We are calling handle.WaitOne(0), which if you look at the 2.0 specification, it doesnt show that a WaitOne function with one parameter of an int. However if I navigate to the definition, it shows up as v2.0.50727 and it compiles fine. So I guess I need to target the specific framework (or make sure the customer has a newer .NET Framework installed)?

Also, do they have updated online msdn docs somewhere for the new versions?

+1  A: 

Use supportedRuntime

RandomNoob
+3  A: 

With the past few releases of Visual Studio, each Visual Studio release only supported a specific version of the .NET Framework. For example, VS 2002 only worked with .NET 1.0, VS 2003 only worked with .NET 1.1, and VS 2005 only worked with .NET 2.0.

( From here )

So I think Visual Studio 2005 will only do what you want. With 2008, you can select which framework to target:

Unfortunately the VS 2008 multi-targeting support only 
works with .NET 2.0, .NET 3.0 and .NET 3.5    

( From same article)

And finally:

VS 2008 does run side-by-side, though, with VS 2005, VS 2003, and VS 2002. So it is definitely possible to continue targeting .NET 1.1 projects using VS 2003 on the same machine as VS 2008.

( From same article)

Update:

WaitHandle..::.WaitOne Method (Int32) says:

Version Information .NET Framework Supported in: 3.5 SP1, 3.0 SP2, 2.0 SP2

So do you both have the same level of service pack?

JeffH
Thanks for the comment, I updated my post based on the answers and with a little more info
SwDevMan81
Yeah, I need to check with our install shield expert to see what we are actually installing. My guess is we didnt install either SP1 or SP2
SwDevMan81
+1  A: 

Microsoft committed a fairly major sin when they released .NET 3.5, they changed the public interface of the WaitHandle class but did not change the [AssemblyVersion] of mscorlib.dll, it was left at version 2.0.0.0. The added WaitHandle method was certainly important, few programmers ever guessed the proper value for the "exitContext" argument (false). But not changing the version gave you this headache to deal with.

There is no good workaround, beyond avoiding using the new overload. Or strongly recommending your customer to re-enable Windows Update. Targeting a specific .NET framework version cannot work since they all got the same version of mscorlib.dll.

Hans Passant
Wow, that is good to know. Thanks nobugz
SwDevMan81
A: 

VS2005, you can change the project file and include the following in the section.

<TargetFrameworkVersion>v3.0</TargetFrameworkVersion>
Greg Domjan