117

I have a TeamCity install on x32 Server2008 windows machine. I've run the .net 4.5 web install. I've also copied over the files from my x64 machine based on this article so that I didn't need to install vs2012 (though, I did have the change the path to remove x86 on the 32bit machine):

MSBuild in TeamCity of Visual Studio 2012 solution

I can't seem to get the local agent to run the build that I've setup for msbuild on a vs2012 or vs2010 project. I keep getting:

Unmet requirements: MSBuildTools12.0_x86_Path exists

I've restarted the server multiple times, and restarted the agent as well. I've tried messing with the path variables a little, but can't figure out what I'm missing. I've looked as well in the Configuration Parameters, and can see these:

MSBuildTools2.0_x86_Path C:\Windows\Microsoft.NET\Framework\v2.0.50727

MSBuildTools3.5_x86_Path C:\Windows\Microsoft.NET\Framework\v3.5

MSBuildTools4.0_x86_Path C:\Windows\Microsoft.NET\Framework\v4.0.30319

How do I get 12.0 in there?

Community
  • 1
  • 1
archangel76
  • 1,544
  • 2
  • 11
  • 18

11 Answers11

148

I needed to install MSBuild separately, then after restarting the agent the variable was there.

(From MSDN article) MSBuild is now installed as part of Visual Studio rather than as part of the .NET Framework. The current MSBuild version number is 12.0. If you want to install MSBuild separately, download the installation package from MSBuild Download.

edit: the answer link was broken. Here is the link for Microsoft Build Tools 2015 (most recently until today): https://www.microsoft.com/en-us/download/details.aspx?id=48159

strongwind
  • 111
  • 1
  • 8
jmw
  • 2,864
  • 5
  • 27
  • 32
  • 8
    It should be noted that you will need the .NET Framework version 4.5.1 (found here: http://www.microsoft.com/en-ca/download/details.aspx?id=40779) to install MSBuild12.0. – Brandon Jan 13 '14 at 20:51
  • 37
    To restart the agent: 1. Go to the build server. 2. Run services.msc from the start menu. 3. Find the TeamCity Agent, stop the service, and restart it. That may seem obvious to seasoned TeamCity vets but not to first-time users like myself. :) – Chaim Eliyah Feb 09 '15 at 23:54
  • 5
    Although I have MS Build Tools 2013 installed, the MSBuildTools12.0_x86_Path variable is still not set and the agent doesn't run. Is there a way to set it manually? – bdaniel7 Apr 07 '15 at 16:27
  • Had to go to this directory, and run vcvars64.bat: C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\amd64 Then msbuild worked for me. – user8128167 Sep 07 '16 at 16:06
  • 5
    By default when I used auto detection of sln file and my solution was set to Visual Studio 2013. I Changed for Visual Studio 2015 installed on agent. – ptittof57 Oct 26 '16 at 12:31
33

A bit of a late answer, but if your project is from VS 2012, and you're using the autodetected solution file build step, editing that step and choosing "Microsoft Visual Studio 2012" from the "Visual Studio" drop down fixes this issue as well (and, IMHO, more correctly).

Harper Shelby
  • 16,475
  • 2
  • 44
  • 51
  • 2
    Not late at all! I had this issue today and changing the VS version to VS 2015 got rid of unmet requirements message – Sudhanshu Mishra Mar 23 '16 at 07:34
  • This worked for me fresh server TeamCity 10 VS2015 (was old 2013 project) – Rippo Sep 14 '16 at 06:37
  • 2
    Yeah, my problem was that the wrong version of Visual Studio was "auto-selected" by Team City when choosing to auto-detect build steps from the "Create Project from URL" option, so I simply went to the build step and changed the Visual Studio version to fix this. I hope people check your answer first before trying to install stuff they might not need in jmw's answer. – starmandeluxe Apr 20 '17 at 01:48
18

I had the same problem and at the end it turned out that my defined build step to run MSBuild was configured wrong.

In my MSBuild build step the setting "MSBuild ToolsVersion" was set to 12.0 (default), which lead to the error "Unmet requirements: MSBuildTools12.0_x86_Path exists" on my system. Because I don't need the new MSBuild 12.0 to run my build, I changed this setting to 4.0 in my build step. This MSBuild version is correctly installed on my system. This solved the issue for me.

10

I'm also a bit late to the party but I thought I'd share the following in case it helps any poor soul out there.

  • I got the above mentioned error on a fresh install of TeamCity 8.1.4 on a new Windows Server 2012 R2 box
  • Followed the instructions in this thread and the error still appeared despite numerous restarts and reinstalls.
  • I noticed that the agent info such as OS and CPU was not appearing on the agent details page. This indicated that the problem was not with the .NET and MSBUILD prerequisites but were instead related to the agent service not being able to read info about the machine.
  • The agent was running under a user's account (with all the necessary permissions as per the TeamCity documentation). But I thought I'd see what would happen if I went in to Admin Tools > Services and changed the Log On to Local system account.
  • Restarted the agent service.
  • Great success.
Robert Hardy
  • 373
  • 4
  • 12
  • Changing the agent to run as local service fixed this problem for me as well. I don't understand why though. I added the user I was using to the local admins group to see if it was a permissions problem but that didn't help; – user381624 Apr 17 '15 at 05:52
8

MSBuild is now part of Visual Studio. If you need to install the build tools on your agent but don't want to install VS, you will need to install the new Microsoft Build Tools which is available at http://www.microsoft.com/en-us/download/details.aspx?id=40760.

Steve Bering
  • 121
  • 2
  • 7
  • 1
    See also: [link for Build Tools **2015** version](https://www.microsoft.com/en-us/download/confirmation.aspx?id=48159) (mentioned link is 2013 tools). – Jeroen Sep 20 '16 at 05:51
  • And [here's the **2017** version](https://visualstudio.microsoft.com/downloads/) (Tools for Visual Studio 2017 -> Build Tools for Visual Studio 2017) – fuglede Oct 11 '18 at 18:12
4

In my case - only separate installation of MSBuild for VS2013 helped. (here is link - https://www.microsoft.com/en-us/download/confirmation.aspx?id=40760 ) It created this folder C:\Program Files (x86)\MSBuild\12.0 Installation of MSBuild tools for VS2015 created C:\Program Files (x86)\MSBuild\14.0 this folder, and TC didn't want to use it.

Skatox
  • 4,237
  • 12
  • 42
  • 47
miotis
  • 41
  • 1
  • 2
2

I had this problem on my secondary build agent.

I had copied the MSBuild folder from the primary build agent pc to the secondary build agent pc (like I did with some Visual Studio files as described here: MSBuild in TeamCity of Visual Studio 2012 solution), rather than installing MSBuild.

It seems, however, that the TeamCity agent services checks the registry for MSBuild entries when it starts up (it does not seem to do this with the Visual Studio files i mention above). Since I had simply copied the files from the other pc, no MSBuild entry for v. 12.0 existed, so TeamCity did not discover the MSBuild files even though they were present in the Program Files (x86)\MSBuild folder.

When I installed the Microsoft Build Tools from the link above http://www.microsoft.com/en-us/download/details.aspx?id=40760 TeamCity found the v. 12.0 entry in the registry and the agent was able to build the same projects as the primary agent.

Remember to restart the TeamCity agent service after installing MS Build Tools.

Community
  • 1
  • 1
Hildesheim
  • 161
  • 2
  • 7
1

In my case I have TeamCity Professional 2018.1 on Windows 2016 Server. I downloaded Build Tools for Visual Studio 2017 from here: https://visualstudio.microsoft.com/downloads/ and selected all options for build tools. After install I added MSBuild to the global PATH environment variable. C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0\Bin in my case.

DerSkythe
  • 429
  • 6
  • 11
0

In my case, it was a new machine without visual studio installed and i just restored Teamcity from another machine. So i have installed visual studio 2013 and solved teamcity agent problem.

Shantu
  • 145
  • 11
0

As was stated above, autodetected build step is probably picked up wrong Visual Studio version. Change it using Visual Studio dropdown under Build Steps section on Build Configuration settings page:

enter image description here

Aleksei Mialkin
  • 2,257
  • 1
  • 28
  • 26
-1

I seemed to solve this issue by going into the registry and deleting all entries for MSBuild that weren't for version 12, then restarted the agent.

To do that, go to Start > Run and type in Regedit

Then navigate to the key:

HKEY_LOCAL_MACHINE > SOFTWARE > Microsoft > MSBuild

Delete all versions except for 12.0.

Go down the next level to ToolsVersions and delete the non-12.0 versions there.

HCdev
  • 550
  • 1
  • 6
  • 20