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

62,220

Solution 1

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

Solution 2

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

Solution 3

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...

Solution 4

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

Share:
62,220
Jean Jimenez
Author by

Jean Jimenez

Software developer, systems analysis and design. Oriented to interact with the business people to provide better solutions to address user needs. Experience in developing solutions using various technologies which range from desktop applications and Web applications and mobile devices.

Updated on July 05, 2022

Comments

  • Jean Jimenez
    Jean Jimenez almost 2 years

    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?

  • Jean Jimenez
    Jean Jimenez over 8 years
    It works, but i would like to know if there is not another workaround to avoid installing visual studio in the development server. Thanks
  • Daniel Mann
    Daniel Mann over 8 years
    No. There's no reason not to install Visual Studio on your build server -- it's not included in licensing costs.
  • rducom
    rducom over 8 years
    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/…
  • Mido
    Mido about 8 years
    Thanks, this was exactly what I needed to do.
  • Chaim Eliyah
    Chaim Eliyah almost 8 years
    Not to nitpick, but what is meant by "reregister the build agent with TFS"? The build agents are already registered. The documentation seems to point to installing a VSO agent on the build server but warns that you can use the existing build servers. The existing build servers don't appear in the list.
  • InteXX
    InteXX almost 8 years
    To your knowledge, does the Community Edition provide the necessary prerequisites for a Build Server configuration?
  • Dewi Rees
    Dewi Rees over 7 years
    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" .
  • Mike Devenney
    Mike Devenney over 7 years
    Not sure why, but @Jubblerbug's suggestion above for Updating All Agents didn't work for me, I had to drop the agent and reconfigure it after installing VS. So, YMMV.
  • aruno
    aruno over 7 years
    @InteXX yes it does - for up to 5 people. see my answer
  • aruno
    aruno over 7 years
    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
  • Koen Zomers
    Koen Zomers over 7 years
    The "Update All Agents" suggested by @Jubblerbug didn't work for me. Simpy rebooting the TFS Build 2017 server did. It automatically updated the capabilities once it restarted. Probably just restarting the TFS Build Windows Service will do it already as well. I'm using on premises TFS Build 2017 agents with Visual Studio Online.
  • ssloan
    ssloan about 7 years
    OP is not asking about hosted agents, they want to configure a new build agent.
  • dougajmcdonald
    dougajmcdonald almost 7 years
    I found this answer when trying to locate information about why the 'Default' option wasn't working for node/npm builds
  • fujiiface
    fujiiface almost 6 years
    Last screenshot in this answer was exactly what I was looking for.
  • Guy Wouters
    Guy Wouters almost 6 years
    but I would like to run Coded UI Tests on a client Windows 10 machine. I don't want to intall VS there
  • Brian Cryer
    Brian Cryer over 4 years
    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.