14

I want to build my VS2010 .sln file (projects are .net 4.0) with msbuild from the command line. I expected this to work...

>C:/Windows/Microsoft.NET/Framework/v4.0.30319/msbuild.exe application.sln

However I get this message:

"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"."

The build continues but it can't find any of my references and fails.

I'm probably missing something obvious... any help would be appreciated.

Thanks,
-dk

3 Answers 3

10

This article maybe helpful: http://blog.prabir.me/post/Downgrading-VS2010-solutions-to-VS2008.aspx

And it seems it's not targeting proper msbuild version (error comes from 3.5 msbuild ver), try to open the Visual Studio 2010 command prompt, go to the solution directory and run msbuild.exe SolutionName.sln

Sign up to request clarification or add additional context in comments.

1 Comment

the script I was running it from had a typo and indeed was calling the 3.5 msbuild. Once I actually called the right exe it worked like a charm.
1

That's odd. Does VS2010 work OK? If not is the key HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSBuild\ToolsVersions\4.0 missing? (Install bad.)

Verify the .sln version number at the top is 11.

Those are the only reasons I can think of.

Dan

Comments

1

This could be of some sort of help.

1 Comment

I'm not the downvoter, but usually on stackoverflow we prefer self-contained answer : links to references are fine, but the answer should be useful on its own. Links to external sites often end up being 404's after a few months, and it's a hassle to click on the link, then search through the page to find the relevant information.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.