I've got a heap of csproj files that were created with Visual Studio 2010 and targeted .NET 4.0.
I am now trying to compile on Mono 2.6.7 with xbuild, however 2.6.7 can't compile verison 4 msbuild projects. (2.10.1 has no issues, which is what we've been using, but I want to do an experiment on 2.6.7).
Using MonoDevelop I've changed the Runtime Version to Mono / .NET 3.5, and it compiles fine under 2.6.7. Changing to use xbuild however fails.
What steps are required to change the MSBuild version to 3.5? The top line in the csproj file is pretty obvious:
开发者_StackOverflow社区<Project ToolsVersion="4.0"
And changing that is easy, but I'm concerned there are less obvious things that should also be changed.
Anyone know the definitive way to downgrade from a 4.0 to 3.5 msbuild file?
I don't know of an authoritative guide, but having done this several times I can say what I know.
For a simple Class Library or WinForms application, it's pretty straight forward:
- The
ToolsVersion
on the project file needs to be set to 3.5, as you indicated. - If there is an
OldToolsVersion
element (meaning it was previously upgraded) in the project file, it should be removed. The same goes forFileUpgradeFlags
andUpgradeBackupLocation
elements. Basically, you don't want theOldToolsVersion
to be the same as the current version. - If you were using the Client Framework profile, in 3.5 the element is called
TargetFrameworkSubset
. In 4.0, it's calledTargetFrameworkProfile
, so the element should be renamed. (Not sure of the applicability to Mono on this one).
Using MonoDevelop, Project->Export the solution to VS2008 format.
Are you sure you have to downgrade the MSBuild version? Just compile with 2.10, switch your environment to 2.6.7, and run the tests.
精彩评论