TeamCity Using Wrong MSBuild Executable?
Asked Answered
H

2

7

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

Hematology answered 21/2, 2010 at 18:20 Comment(2)
You realize that .NET 4.0 is still in beta, right? Are you sure you don't want 3.5 or 2.0?Fernandez
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.Hematology
H
5

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.

Hob answered 21/2, 2010 at 18:56 Comment(0)
K
4

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.

Keats answered 15/4, 2010 at 19:24 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.