We have TFS 2015 server and also a build server with Visual Studio 2017 Ultimate. TFS agent is not able to detect VisualStudio or VsTest capabilities (as it should) but when added manually, there is still a problem.
When it comes to Visual Studio Test step then console shows the following error and fails:
c:\AgentTest\tasks\VSTest\1.0.30\VSTest.ps1
Unable to determine the location of vstest.console.exe
I added the following capabilities manually:
VisualStudio C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise VisualStudio_15.0 C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise
VisualStudio_IDE C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE
VisualStudio_IDE_15.0 C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE
VS150COMNTOOLS C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\Tools\
VSTest C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\CommonExtensions\Microsoft\TestWindow
VSTest_15.0 C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\CommonExtensions\Microsoft\TestWindow
I can reproduce this issue, TFS 2015 agent cannot identify VStest and some other 2017 related capabilities.
Based on the test, TFS 2015 should not support for 2017 VStest.
According to this Github discussion, it seems that the core issue is the Visual Studio Test task needs updated to support VS 2017.
In TFS 2017 and VSTS, we can specify the absolute path of the vstest.console.exe
to let it work (See this article for details), but in TFS 2015 we can not specify the path in the task, it's not support.
So, if you want to use Vstest, you can install VS 2015, or upgrade to TFS 2017 or later version.
Similar thread for your reference: https://social.msdn.microsoft.com/Forums/vstudio/en-US/1f9992f3-20b6-437a-855d-ccd67ff2298e/using-tfs-2015-with-build-agent-and-visual-studio-2017?forum=tfsadmin