VSTest task fails to locate VSTest.console.exe on build machine with only Visual Studio Agents installed
See original GitHub issueI have a build machine that has, roughly, .NET 4.6, the VSO Agent, Microsoft Build Tools 2015 and the Agents for Visual Studio 2015 installed.
Running a VSTest task as part of a build on this build agent results in the following error:
2015-08-17T12:41:38.1761372Z Executing the powershell script: C:\vsoagent\tasks\VSTest\1.0.16\VSTest.ps1
2015-08-17T12:41:39.2073467Z ##[debug]Calling Invoke-VSTest for all test assemblies
2015-08-17T12:41:39.2385874Z ##[error]Unable to determine the location of vstest.console.exe
2015-08-17T12:41:39.2542123Z ##[warning]No results found to publish.
It seems this is caused by the Microsoft.TeamFoundation.DistributedTask.Task.Internal.PowerShell.InvokeVSTestCmdlet
task not being able to properly resolve the location in which VSTest.console.exe
is located; the GetVsTestLocation
method attempts to resolve locations in which Visual Studio is installed (it is not installed in this scenario).
VSTest.console.exe
is present on this machine at C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\CommonExtensions\Microsoft\TestWindow
- it was installed as part of the Agents for Visual Studio 2015 package.
It seems that the path in which VSTest.console.exe
is located can be retrieved by looking at the HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\14.0\EnterpriseTools\QualityTools
registry key, where the InstallDir
entry contains the right value.
As a workaround, faking a ShellFolder
value in the HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\14.0
key also works.
Issue Analytics
- State:
- Created 8 years ago
- Reactions:4
- Comments:9 (3 by maintainers)
Top GitHub Comments
@chrisrpatterson I just hit this same issue on a machine that has both VS2015 and VS2017 RC installed, so it seems there is anther problem. Modifying the registry manually feels like a workaround instead of a “fix”. Can we re-open this issue?
Note: It’s worth mentioning that the registry modification didn’t fix the problem for me. My current workaround is passing the absolute path to vstest.console.exe as part of the build definition, but it seems that the core issue is that this task needs updated to support VS 2017.
Using TFS 2017.1 and a build agent having only VS 2017 installed. Switching to the v2 of the task - still in preview - worked for me as well.