1.9.0.12 The expression '$Agent.VSTest.Console.2017.Path$' exists evaluated False

Hi, I am not sure if this is a bug or misuse. I am trying to run VSTest action using 'VSTest.Console.2017'.

Build agent complaints: 'No agents are currently available to execute the stage.'
The expression ['$Agent.VSTest.Console.2017.Path$' exists] evaluated False. '$Agent.VSTest.Console.2017.Path$' does not exist. This may be because a required tool is not installed on the agent.

I am not able to get the path it tries to look up. However, I have checked that the 'vstest.console.exe' does exists at:
'C:\Program Files (x86)\Microsoft Visual Studio\2017\TestAgent\Common7\IDE\CommonExtensions\Microsoft\TestWindow'

I have even installed MS test agent to run tests with MSTest.exe but failed:
Could not expand property Target with value '$Agent.MSTest.VisualStudio.2017.Path$' . The expression [$Agent.MSTest.VisualStudio.2017.Path$] contains errors: Unknown object : MSTest

The 'Property Collectors' contains both:

  • MSTest.VisualStudio.2017
  • VSTest.Console.2017

But the 'Agent Properties' does not include the properties, why? I am reluctant to add the properties manually as the agent should locates the file(s) at their default installed location(s).

NB! Server and agent are running at the same machine.

HI JPollack,

The Search Paths field for the VSTest.Console.2017 property collector is set to search the following paths by default.

%PROGRAMFILES%\Microsoft Visual Studio\2017\Community\Common7\IDE\CommonExtensions\Microsoft\TestWindow\
%PROGRAMFILES(x86)%\Microsoft Visual Studio\2017\Community\Common7\IDE\CommonExtensions\Microsoft\TestWindow\
%PROGRAMFILES%\Microsoft Visual Studio\2017\Professional\Common7\IDE\CommonExtensions\Microsoft\TestWindow\
%PROGRAMFILES(x86)%\Microsoft Visual Studio\2017\Professional\Common7\IDE\CommonExtensions\Microsoft\TestWindow\
%PROGRAMFILES%\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\CommonExtensions\Microsoft\TestWindow\
%PROGRAMFILES(x86)%\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\CommonExtensions\Microsoft\TestWindow\

We didn't know that about the C:\Program Files (x86)\Microsoft Visual Studio\2017\TestAgent installation path. It appears that this is the default location when installing Agents for Visual Studio 2017. We usually install Build Tools for Visual Studio 2017 or a full edition of Visual Studio 2017. We've now added this to the default list of paths for the next version.

Meanwhile you can add %PROGRAMFILES(x86)%\Microsoft Visual Studio\2017\TestAgent\Common7\IDE\CommonExtensions\Microsoft\TestWindow\ to a new line in the Search Paths field to get this working. The MSTest one is a little different as the search paths cannot be edited - you can either add a new PathFinder property collector for this, or select a Custom path for the MSTest action Using field. We're also updating the MSTest property collector paths for the next version.

Hi Dave,

Added the TestAgent path to the ‘VSTest.Console.2017’ property at the Property Collectors. This worked great!
As the VSTest actions is all good for me I removed the MSTest action all together. The MSTest action was actually working when Using is set to Custom and Path to ‘C:\Program Files (x86)\Microsoft Visual Studio\2017\TestAgent\Common7\IDE\MSTest.exe’.

Thanks to your hind I discovered that the ‘Visual Studio Build Tools 2017’ has option to install ‘Testing tools core features - Build Tools’ which I had unchecked. Now, after installing the missing build tool component, I could uninstall the MS Test Agent for good. This cleans up the installation location. Otherwise I would have the ‘vstest.console.exe’ at two different locations.

Then I had to add (another) new location of ‘vstest.console.exe’ to the ‘VSTest.Console.2017’ property at the Property Collectors (please include it too in your next release):
%PROGRAMFILES(x86)%\Microsoft Visual Studio\2017<b>BuildTools\Common7\IDE\CommonExtensions\Microsoft\TestWindow
Now I could run the tests again.