tags:

views:

24

answers:

2

When I use msbuild on a .NET 4.0 project it appears to attempt to build the project with .NET 3.5. I've got Visual Studio 2010 installed and the project will build just fine in VS. It seems like an easy problem, but i'm kind of stuck.

So I use the command

msbuild C:\ProjectPath\ProjectName.csproj

and I get the error.

Build started 9/30/2010 10:19:41 AM. Project "C:\ProjectPath\ProjectName.csproj " on node 0 (default targets). Project file contains ToolsVersion="4.0", which is not supported by this version of MSBuild. Treating the project as if it had ToolsVersion="3.5". ResolveAssemblyReferences:

+2  A: 

Are you sure that MSBuild 4.0 is used? Launching MSBuild from commandline you should see :

Microsoft (R) Build Engine Version 4.0.30319.1
[Microsoft .NET Framework, Version 4.0.30319.1]
Copyright (C) Microsoft Corporation 2007. All rights reserved.

If the right version isn't use, you'll have to launch MSBuild inside Visual Studio 2010 Command Prompt or put .NET 4 directory (%windir%\Microsoft.NET\Framework\v4.0.30128) in your path.

madgnome
A: 

You are probably using msbuild.exe from the 3.5 directory. Instead use msbuild.exe under %windir%\Microsoft.NET\Framework\v4.0.30128. If you open a Visual Studio command prompt from VS 2010 start menu under VS Tools this path will be on your %path%.

Sayed Ibrahim Hashimi