Hubris
Hubris

Reputation: 2022

Error Upgrading To .NET 4.5

I'm trying to upgrade from VS2010 .NET 4 to VS2012 .NET 4.5 and I'm getting the following error in each Project that I've set to .NET 4.5 when they try to build.

The expression "[Microsoft.Build.Utilities.ToolLocationHelper]::GetPathToStandardLibraries(.NETFramework, ?, '', '')" cannot be evaluated. Version string portion was too short or too long.

I can't find any references to this in my code and the msdn reference for the function doesn't provide any hints (http://msdn.microsoft.com/en-us/library/hh135279.aspx).

Anyone seen this before or know the solution?

Edit

The solution listed here doesn't seem to work. http://social.msdn.microsoft.com/Forums/da-DK/vseditor/thread/8ca4a9b0-742d-487d-ab8c-6c3a80cffd40

Upvotes: 6

Views: 8005

Answers (3)

I had the same problem when upgrading from 4.6.1 to 4.7.2 framework. I had a big solution with many projects. This error turned out when building the last project (win application), which had the correct <TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>.

The cause of the problem were the other projects, used by the win app project. They had incorrect framework versions.

Upvotes: 2

Jeremy Parker
Jeremy Parker

Reputation: 418

Unload your project and remove the below tag from your .csproj file:

<TargetFrameworkVersion></TargetFrameworkVersion>

and reload your project again, it works for me.

Upvotes: 1

Hubris
Hubris

Reputation: 2022

Somehow after multiple tries, including restarting the machine and visual studio, this started working for no apparent reason.

Upvotes: 3

Related Questions