Pages

Sunday, June 6, 2010

Gotchas when upgrading from VS2008 to VS2010

Ran into a few issues when upgrading a solution with 26 projects from Visual Studio 2008 to Visual Studio 2010.

I started by creating a new solution file to be used by VS2010 and added the existing projects.

Issue 1 - Referencing a higher framework version

VS2008 was fairly accepting of a framework 2.0 project referencing DLL's or projects with a higher framework target.

VS2010 will stop the build with a error like:

C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(1360,9): warning MSB3268: The primary reference "newerFrameworkProject, Version=18.0.0.0, Culture=neutral, processorArchitecture=MSIL" could not be resolved because it has an indirect dependency on the framework assembly "PresentationFramework, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" which could not be resolved in the currently targeted framework. ".NETFramework,Version=v2.0". To resolve this problem, either remove the reference "newerFrameworkProject, Version=18.0.0.0, Culture=neutral, processorArchitecture=MSIL" or retarget your application to a framework version which contains "PresentationFramework, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" and errors that all the functions/types used in the api dll are not defined.

In this case adding <SpecificVersion>true</SpecificVersion> to the reference resolves the issue.

See Also

Issue 2 - Project ToolsVersion

The ToolsVersion attribute on the Project node is changed from 3.5 to 4.0 by the upgrade wizard.

Before
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5">
After
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">

Since our TFS build server hasn't been updated yet I needed to revert this in the TFSBuild.proj

Issue 3 - Microsoft.WebApplication.targets path

The project import for Microsoft.WebApplication.targets differs for VS2010. See Working with both VS 2010 and 2008 on the team for a solution using conditional statements.

Issue 4 - System.Web.Security provider types have been forwarded to System.Web.ApplicationServices

See System.Web.MembershipProvider and RoleProvider references not found in unit tests after VS2010 upgrade

No comments:

Post a Comment