windowsazure-devopsazure-pipelinesazure-agent

Where to install software on azure pipeline agent?


I am trying to install the Microsoft.TestPlatform package on a self-hosted windows azure pipeline agent in order to use the VSTest task in my pipeline YAML specification. My agent does not have Visual Studio installed, which I understand installs this package alongside it.

I have installed the NuGet package on my agent by running the nuget install microsoft.testplatform command in the windows command prompt.

After adding vstest as an environment variable with value true, restarting the agent service and running my pipeline which uses the VSTest@3 task, I get the following error message:

Test selector : Test assemblies
Test filter criteria : undefined
Search folder : C:\agent\_work\40\s
Action when minimum tests threshold not met : donothing
Minimum tests expected to be run: 0
VisualStudio version selected for test execution : latest
Attempting to find vstest.console from a visual studio installation with version [17.0,18.0).
Attempting to find vstest.console from a visual studio build tools installation with version [17.0,18.0).
Attempting to find vstest.console from a visual studio installation with version [16.0,17.0).
Attempting to find vstest.console from a visual studio build tools installation with version [16.0,17.0).
Attempting to find vstest.console from a visual studio installation with version [15.0,16.0).
Attempting to find vstest.console from a visual studio build tools installation with version [15.0,16.0).
##[error]Error: Visual Studio 2015 is not found. Try again with a version that exists on your build agent machine.

My agent lives at /c/agent but can't seem to find my executable vstest.console.exe at C:\Temp\Microsoft.TestPlatform.17.11.1\tools\net462\Common7\IDE\Extensions\TestPlatform.

I have tried mimicking the file path that the test platform extension would be installed at if visual studio were installed, by moving the test platform exe's to C:\Program Files (x86)\Microsoft Visual Studio\2022\Enterprise\Common7\IDE\Extensions\TestPlatform, but it changes nothing.


Solution

  • As per Visual Studio Test task's documentation, .NET Framework 4.6.2 or a later version must be installed when using the task in a Windows self-hosted agent.

    Also, the agent must have the vstest capability which can be satisfied in two ways: