2
votes

I am trying to create a custom build server for Visual Studio Team Services in Azure. I have installed the build agent and Visual Studio Express on a virtual machine which is running and connected to my project on visualstudio.com as a build agent in the "Default" pool.

However when I tried to run a build I got the following error:

No agent found in pool 1 which satisfies the specified demands:
msbuild
visualstudio
vstest
Agent.Version -gtVersion 1.98.1

MSBuild was already in the list of capabilities on visualstudio.com but not the other two, so I dug through C:\Program Files (x86) and added these two capabilities to the list:

vstest: C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\CommonExtensions\Microsoft\TestWindow
visualstudio: C:\Program Files (x86)\Microsoft Visual Studio 14.0

The build then runs at least but I get another error during the "Test Assemblies" step. I think the most important part of the error message is Unable to determine the location of vstest.console.exe, here it is in full anyway:

System.Management.Automation.CmdletInvocationException: Unable to determine the location of vstest.console.exe ---> System.IO.FileNotFoundException: Unable to determine the location of vstest.console.exe
at Microsoft.TeamFoundation.DistributedTask.Task.Internal.PowerShell.InvokeVSTestCmdlet.GetVsTestLocation()
at Microsoft.TeamFoundation.DistributedTask.Task.Internal.PowerShell.InvokeVSTestCmdlet.ProcessRecord()
at System.Management.Automation.CommandProcessor.ProcessRecord()
--- End of inner exception stack trace ---
at System.Management.Automation.Runspaces.PipelineBase.Invoke(IEnumerable input)
at System.Management.Automation.PowerShell.Worker.ConstructPipelineAndDoWork(Runspace rs, Boolean performSyncInvoke)
at System.Management.Automation.PowerShell.Worker.CreateRunspaceIfNeededAndDoWork(Runspace rsToUse, Boolean isSync)
at System.Management.Automation.PowerShell.CoreInvokeHelper[TInput,TOutput](PSDataCollection`1 input, PSDataCollection`1 output, PSInvocationSettings settings)
at System.Management.Automation.PowerShell.CoreInvoke[TInput,TOutput](PSDataCollection`1 input, PSDataCollection`1 output, PSInvocationSettings settings)
at Microsoft.TeamFoundation.DistributedTask.Handlers.PowerShellHandler.Execute(ITaskContext context, CancellationToken cancellationToken, Int32 timeoutInMinutes)
at Microsoft.TeamFoundation.DistributedTask.Worker.JobRunner.RunTask(ITaskContext context, TaskWrapper task, CancellationTokenSource tokenSource)

I have looked and vstest.console.exe is located in the vstest folder I specified above, I've also tried adding this folder to the system PATH but that makes no difference.

How can I set up a working build agent in Azure?

4
Which version of Visual Studio do you have installed? One prior to VS 2015? Or have you installed the Community Edition of 2015?Wouter de Kort♦

4 Answers

1
votes

Visual Studio Express doesn't have the testing tools. Install Visual Studio Community (assuming you qualify for Community based on the licensing terms), or a Visual Studio edition (professional/enterprise) for which you or your organization is licensed.

1
votes

In TFS Build Logs under Test Assemblies I see the error:

System.Management.Automation.CmdletInvocationException: Unable to determine the location of vstest.console.exe

I had VSTest set as Visual Studio 2015, I'm using VS/TFS2017 so switching to Latest solved the problem:

enter image description here

0
votes

You'll want to install Visual Studio on your build server. At that point, the build agent will recognize the capabilities available like msbuild, visualstudio, and vstest.

0
votes

I found a solution, you just have to convince your build machine that it does actually have VS installed. From the link:

What worked for me was to create the following registry key: HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\14.0

and within that key, create a new value of type string with name ShellFolder and value C:\Program Files (x86)\Microsoft Visual Studio 14.0.

Hope it helps