question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

VSTest task fails to locate VSTest.console.exe on build machine with only Visual Studio Agents installed

See original GitHub issue

I 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:closed
  • Created 8 years ago
  • Reactions:4
  • Comments:9 (3 by maintainers)

github_iconTop GitHub Comments

7reactions
golfguy0082commented, Feb 23, 2017

@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.

5reactions
mderrieycommented, May 8, 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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Visual Studio Test task cannot locate vstest.console.exe
we have encountered a problem that Visual Studio Test task (version 2.156.2) is not able to find vstest.console.exe. The vstest is located at:...
Read more >
VSTest.Console.exe command-line options - Microsoft Learn
Console.exe. Open Developer Command Prompt to use the command-line tool, or you can find the tool in %Program Files(x86)%\Microsoft Visual ...
Read more >
Unable to determine the location of vstest.console.exe easy fix
The easiest way to fix this problem is copy your real unit test tool to the “target” folder build agent tried to find....
Read more >
Change the location of vstest.console in TFS 2017 Build
Can you try to run vswhwere.exe and check which version of VS is installed at C:\Program Files (x86)\Microsoft Visual Studio\2017\ SQL folder ...
Read more >
Automating Selenium Tests in Azure Pipelines
Run Selenium UI tests: This task uses vstest.console.exe to execute the selenium testcases on the agent machines. Click on IIS Deployment ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found