tags:

views:

105

answers:

2

When I type...

Msbuild<Enter>

... At the command prompt, I get...

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

This is all very well and good except that when I run this against a vs2010 .sln file, the error message indicates:

MyProject.sln(2): Solution file error MSB5014: File format version is not recognized.  MSBuild can only read solution files between versions 7.0 and 9.0, inclusive.
0 Warning(s)
1 Error(s)

It would appear that the version of msbuild that is being called, is not capable of understanding my solution file.

I figured that I would check out my path and see where msbuild is being picked up from. However, it seems that no part of my path points at a location where msbuild is to be found.

How is the command line finding the copy of msbuild that it is using and how can I change this version so that the latest version is used?

+1  A: 

Change your environment variables.

Find/set your MSBuild path variable to be C:\Windows\Microsoft.NET\Framework\v4.0.30319

Obiviously the above path will depend on your installation location, but it will be close if not exact.

Finglas
+3  A: 

It must be in somewhere in the PATH environment. Use 'where msbuild' to determine where it is loading msbuild from.

Use the Visual Studio Command Prompt (2010) shortcut to initialize the path and other environment variables for VS 2010 and MSBuild 4.0.

Kyle Alons
As predicted... I had C:\Windows\Microsoft.NET\Framework\v2.0.50727\ in my path, but was essentially blind to it. Thanks.. the Where comand is something I've never seen before... great call
Rory Becker