76

I'm setting up a new build server using TFS 2015 and after I configured the agent, when I tried to queue a build I got this error:

No agent could be found with the following capabilities: msbuild, visualstudio, vstest

How can this be resolved?

13 Answers 13

60
Answer recommended by CI/CD Collective

Install Visual Studio on your build agent, then restart the build agent. Restarting the build agent will capture the added Capabilities.

10
  • 5
    It works, but i would like to know if there is not another workaround to avoid installing visual studio in the development server. Thanks Commented Aug 6, 2015 at 18:47
  • 6
    No. There's no reason not to install Visual Studio on your build server -- it's not included in licensing costs. Commented Aug 6, 2015 at 18:57
  • 6
    I agree, VS isn't included in the "official TFS build deployment prerequisites", but by looking at the little lines, in fact, it is .... It's annoying... msdn.microsoft.com/en-us/library/…
    – rducom
    Commented Oct 7, 2015 at 13:04
  • 3
    To your knowledge, does the Community Edition provide the necessary prerequisites for a Build Server configuration?
    – InteXX
    Commented Jul 7, 2016 at 22:46
  • 18
    Just to add to this, I found that the quickest way to "update" the builds after installing new capabilities on your build agent servers is to go to the Agent pools hub in the admin area (<your tfs server>/tfs/_admin/_AgentPool?hubGroupId=ms.vss-web.account-admin-hub-group), select the pool your agents are in and right click "Update All Agents" .
    – Dewi Rees
    Commented Sep 2, 2016 at 9:23
29

Note: First of all, you can do all this with the community edition and TFS Express 2015 on your own server (for free up to five users) - so don't worry about needing to use the Visual Studio online version or paying for Visual Studio Professional.


It is very easy to misinterpret the error message provided and go off on a wild-goose chase trying to debug it.

Unfortunately the message itself is just badly worded and that's the real problem.

Here is what that error message really means:

"No agent could be found with the following capabilities: msbuild, visualstudio, vstest. In fact I didn't actually find ANY build agents configured for the selected build queue."

So you're thinking that doesn't apply to you because you just created a build agent?

Well, maybe you did, but here's what probably happened:

  • You created a new pool (for no reason other than you just thought you ought to).
  • You then created a queue under that pool.
  • You ran the PowerShell script to create an agent and you assumed it put it in the pool you just created....
  • But it didn't - it put it in the 'default' pool which you aren't even using...

Aha! So here's what happens when you build:

  • You select a queue from the dropdown.
  • TFS tries to build by looking for the pool that corresponds to that queue and it doesn't find any agents AT ALL there, so you get a stupid useless red-herring error message.

When I finally realized what happened I just deleted my cutely named pool + queue and just reverted to using the default pool.

Next time I will try to pay more attention to this message during the PowerShell configuration:

Configure this agent against which agent pool? (default pool name is 'default')

You will have to create a queue under the pool, but then your agent should start working.

If you have a genuine with a certain capability being absent from your agent you can check what your agent supports via the 'capabilities' tab shown here. Of course msbuild, visualstudio and vstest are all here :-)

Enter image description here

1
  • Last screenshot in this answer was exactly what I was looking for.
    – fujiiface
    Commented Jun 18, 2018 at 23:00
12

In my case, after installing MSBuild (https://www.visualstudio.com/downloads/, search for "Build Tools for Visual Studio 2017"), I just had to add the path to MSBuild to the PATH environment variable. The agent wasn't detecting MSBuild until I did that.

C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0\Bin

I did NOT have to install the full Visual Studio IDE. The selected answer for this question is just plain wrong...

3
  • 6
    I used the slightly later "Build Tools for Visual Studio 2019" and the path I had to add was: C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\MSBuild\Current\Bin. Yes, don't need the full Visual Studio. Thank you for the tip. Commented Aug 20, 2019 at 15:55
  • @Brian where do you set that path variable in VS 2019?
    – JanF
    Commented Dec 21, 2022 at 5:47
  • 1
    @JanF, it is an environment variable so set in Windows rather than in Visual Studio. For Windows 10 Pro: Windows Explorer > Right click "This PC" and select Properties > Advanced system settings (at bottom of form) > On the "Advanced" tab there is a button for "Environment Variables...". That will give you the option to edit the path. Leave what is there, just add the new folder. Commented Dec 21, 2022 at 16:04
8

By default, when using the new build system on VSO, it doesn't pick the hosted build option, which is how I ended up on this post in Stack Overflow. If you are used to using a VSO build server here's what you need to do:

Create a hosted build by going to the General tab and changing your Default Queue to hosted. More on the restrictions of that and how it works here: https://www.visualstudio.com/get-started/build/hosted-agent-pool

1
  • If you're running your own TFS (including TFS Express 2015) then don't panic if you don't see a hosted build option. You can just use the default Commented Nov 6, 2016 at 3:59
1

Add them as User-defined capabilities, e.g.:

visualstudio   C:\Program Files\Microsoft Visual Studio\2022\Community

vstest         C:\Program Files\Microsoft Visual Studio\2022\Community\Common7\IDE\CommonExtensions\Microsoft\TestWindow

I had initially installed the agent on a machine that did not have Visual Studio installed. However, after installing Visual Studio (and then Visual Studio Build Tools), restarting/recreating my agent, restarting my machine, etc., I could not get the agent to detect the new capabilities automatically, so I added them myself in Azure DevOps as User-defined capabilities.

0

I had this issue and it turned out being my release process had selected the "wrong" agent. Just edit the release and set the correct agent queue

enter image description here

0

I was using a Xcode build slave for building an Xcode project.

And the error message I ended up with in TFS 2015 was

"No agent could be found with the following capabilities: xcode"

I registered an OS X on-premise build slave.

In the "Register Agent" step, I named by build agent:

>> Register Agent:

Enter agent pool (press enter for default) > My-Xcode-Agent-Pool

So, I had to select the "My-Xcode-Agent-Pool" as Default queue in the build settings. Source: Microsoft-hosted agents

0

Although none of previous answers worked for me, the post by Simon_Weaver pointed me in the right direction.

He mentioned that vstest was in his list, but it wasn't in mine. I fixed it by adding a user-defined capability named "vstest" with the full path to vstest.console.exe under Visual Studio 2017.

0

What ended up working for me was to go to where I downloaded the agent and running:

./config.cmd remove then ./config.cmd to reinstall the agent from the command line inside the directory of my agent.

Download agent

0

per microsoft https://msdn.microsoft.com/en-us/ie/bb399135(v=vs.94)

You must install on the build agent the version of Visual Studio that your team uses on its dev machines. See Installing Visual Studio. You must also install any other software and components that are installed on your dev machines and that are required to build your app.

0

In my case, after installing MSBuild, restart all Azure services (in windows service) and it worked. No need to install full Visual Studio

-1

You have to install the correspondent Visual Studio version on the build machine (where you have installed your agent). This will add the required tools and capabilities to the server.

Visual Studio is required, because it installs all the build targets required to build your projects.

After being installed, you have to restart the agent Windows service so that it refreshes the list of capabilities.

Since you are using the Visual Studio installation on the build machine to build, that installation doesn't count as an additional license.

-2

General solution for TFS:

The common way of resolving most of the issues on the build server is to install Visual Studio & all dependent packages on your build server.

Alternative solution in case of using VSTS

When you choose where to build, use "Hosted" and then the build will work.

The guide how to make it work may be found here: Deploy an agent on Windows for TFS 2015

Check the agent section which will contain information about capabilities.

Updated:

Once you have the list of capabilities in vsts(azuredevops) you might need to install the desired software on your build agent machine.

PS Be aware, you might have to license your sw, if required.

2
  • OP is not asking about hosted agents, they want to configure a new build agent.
    – ssloan
    Commented Mar 29, 2017 at 11:28
  • I found this answer when trying to locate information about why the 'Default' option wasn't working for node/npm builds Commented May 26, 2017 at 9:44

Not the answer you're looking for? Browse other questions tagged or ask your own question.