views:

432

answers:

2

I'm building an MSBuild file and using it with the MSBuild Build Runner within TeamCity (5.0.2 (build 10784)), but I don't think it's running the right version of MSBuild because I keep getting the following error:

error MSB5014: File format version is not recognized. MSBuild can only read solution files between versions 7.0 and 9.0, inclusive.

I'm a total newbie with TeamCity, so I'm not sure where to begin to look how to configure this. As you can see from the screenshot below, I have selected version 4.0 in the build runner configuration screen.

Build Configuration

+5  A: 

Based on the error it seems like Team City/MSBuild congifuration does not support VS2010. Solutions for VS2010 are version 10.0 where as the error indicates it only supports version 7.0 to 9.0.

Here is a forum thread discussing building VS2010 projects using TeamCity.

smaclell
That did it! Thank you very much.
senfo
+1  A: 

Extracting the answer from the forum thread:

The issue is fixed in TeamCity 5.1, but there's a hack to make it work in 5.0

Basically, you need to override the mechanism that sets the path to MSBuild.exe based on version of .NET framework specified in build runner part of the build configuration.

To do that, create environment variable "MSBuild" and set it to %system.DotNetFramework4.0_x86_Path% (which is a variable automatically generated by the build runner when it detects that it has .NET 4.0 installed)

The variable can either be created on the agent, in the buildAgent.properties file, in this case it should be named "env.MSBuild", and since it is defined globally, it will affect all projects built on this build agent.

Or, it can be created inside the build configuration itself (then the name would be simply "MSBuild") -- in this case it will only apply to this build configuration.

zvolkov