7
votes

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

2
You realize that .NET 4.0 is still in beta, right? Are you sure you don't want 3.5 or 2.0?TrueWill
Yep...I'm building a series of brown bag demos centered around VS2010. A large percentage of the audience is unfamiliar with Continuous Integration, so I'm also building a CI demo to introduce it to the group. Since they are already familiar with my project (including unit tests) I prefer to use the same demo project I've used in other demos.senfo

2 Answers

5
votes

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.

4
votes

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.