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.
Currently we expect VS to be on the build machine as that is how most SDKs and tools are delivered.
Hi, can you provide more information about the work around? What exactly should be done to create the ShellFolder? Not very familiar with registry edits so want to be 100% sure I'm doing the right thing
Hi @spacemonkey1985,
What worked for me was to create the following registry key:
HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\14.0
and within that key, create a new value of type string with name ShellFolder and value C:\Program Files (x86)\Microsoft Visual Studio 14.0\.
Hope it helps
@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.
Same for me with VS2017 RTM
@anthyme @golfguy0082
are you using tfs on prem or vsts. if on prem whats the version? which version of vstest task are you using?
and whats the error.
@acesiddhu
I'm using vsts with a local build agent. I tried again today, and it looks like the latest version of the task (2.0.19) fixed this issue for me.
@golfguy0082 thanks for confirming.
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.
Most helpful comment
@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.