Adding References in VS2010 RC picks up incorrect version - by Red_falcon

Status : 

  Fixed<br /><br />
		This item has been fixed in the current or upcoming version of this product.<br /><br />
		A more detailed explanation for the resolution of this particular item may have been provided in the comments section.

Sign in
to vote
ID 544244 Comments
Status Closed Workarounds
Type Bug Repros 0
Opened 3/24/2010 5:54:54 AM
Access Restriction Public


When picking reference for class library ex. System.dll shown as version 4.0.0 VS2010 adds 2.0.50727. It happens for other assemblies too.
Sign in to post a comment.
Posted by Red_falcon on 3/31/2010 at 11:00 AM

thanks for clarifying this thing. I indeed expected other target framework property instead of 2.0. Now i know how to compile further projects under VS2010 without trouble about target framework version.
Posted by Microsoft on 3/31/2010 at 10:31 AM

Thanks for your reply. Visual Studio uses two separate proprties in the project file:
- Project ToolsVersion: this attribute indicates the version fo Visual Studio that corresponds with that project file. These are the latest ToolsVersions:
ToolsVersion="3.5" - This is VS2008
ToolsVerison="4.0" - This is VS2010

- TargetFrameworkVersion: this property indicates the framework that your project is targeting. It is per project. There is no way to retarget all of the projects in a solution other than change the property for each project. These are the target frameworks supported by the latest versions of VS:
VS2008: 2.0, 3.0, 3.5
VS2010: 2.0, 3.0, 3.5, 4.0

When you convert a VS2008 project to Dev10, we only change the ToolsVersion from "3.5" to "4.0", however we do not change the TargetFrameworkVersion. If you want to target 4.0, you need to change the TargetFrameworkVersion to "4.0". Once you have converted a project to VS2010, you cannot convert it back to VS2008.

Note that the TargetFrameworkVersion 2.0, 3.0 and 3.5 run on the 2.0 runtime. An assembly targeting 3.5 is really a 2.0 runtime assembly.

When you say "When i change target framework to 3.5 it still compiles for 2.0" do you mean that we still create a 2.0 runtime assembly? this is expected.

Let me know if this helps.
Posted by Red_falcon on 3/30/2010 at 3:23 PM
I started an issue thread a while ago at

All of the projects were targeting .Net 4.0

The guys found how to get it all compiled. But nonetheless the problem appeared with other projects which were converted from VS2008.

I converted a project which i'm developing for a company from VS2008 to VS2010 cause i had problems with SQL under WinXP where i had VS2008. So the fastest way to get back to developing and testing was to start VS2010 under Win7, later it will be all converted to VS2008 back. When i change target framework to 3.5 it still compiles for 2.0

This project has no hard-coded references and i didn't get errors, but it's strange that conversion doesn't do well job.
Posted by Microsoft on 3/29/2010 at 9:42 AM
Hi Red Falcon

Thanks for reporting this issue. The license agreement for OpenTK is being reviewed, meanwhile we have some questions for you:

You mention that after conversion 2 projects (OpenTK.Examples and OpenTK.Compatibility) fail. Do they fail to build? if so, can you please provide a log of your build operation. To do so, please change the following setting "Tools -> Options -> Projects and Solutions -> Build and Run -> MSBuild project build output verbosity" to "Diagnostic" and provide the output window content. Are you only getting warnings or build errors.

You mention "VS2010 doesn't change the appropriate version of assemblies to ex. .Net4.0 cause it selects 2.0 automatically. This results in BadImageFormatException when using from client application."
- Can you please confirm that all of the projects are targeting 4.0? you can check this in project properties.
- In this case the project built and you tried to use the output. Was this for another project? I'm confused if the build issues above impacted you here.
- We have often seen projects that have hard-coded references and therefore do not retarget correctly. Can you please open the project files that have issues in notepad and take a look at the references? if a reference is fully qualified (we specify version numbers or a HintPath in the reference tag) try deleting the full qualification and just leaving the simple name.

I'm looking forward to hearing from you.
Posted by Microsoft on 3/24/2010 at 10:20 PM
Thank you for reporting the issue.
We are routing this issue to the appropriate group within the Visual Studio Product Team for triage and resolution.These specialized experts will follow-up with your issue.