diff --git a/src/RunTests/RunVSTestTask.cs b/src/RunTests/RunVSTestTask.cs index 7c36261..eb38991 100644 --- a/src/RunTests/RunVSTestTask.cs +++ b/src/RunTests/RunVSTestTask.cs @@ -139,7 +139,15 @@ public class RunVSTestTask : ToolTask /// protected override string GenerateFullPathToTool() { - return $@"{Environment.GetEnvironmentVariable("VSINSTALLDIR")}\Common7\IDE\CommonExtensions\Microsoft\TestWindow\vstest.console.exe"; + // Attempt to look in the VS installation dir + string vsInstallDir = Environment.GetEnvironmentVariable("VSINSTALLDIR"); + if (!string.IsNullOrEmpty(vsInstallDir)) + { + return $@"{vsInstallDir}\Common7\IDE\CommonExtensions\Microsoft\TestWindow\vstest.console.exe"; + } + + // Fallback to looking for the tool on the PATH + return ToolExe; } /// diff --git a/src/RunTests/build/Microsoft.Build.RunVSTest.props b/src/RunTests/build/Microsoft.Build.RunVSTest.props index 9d8b501..bd1fe62 100644 --- a/src/RunTests/build/Microsoft.Build.RunVSTest.props +++ b/src/RunTests/build/Microsoft.Build.RunVSTest.props @@ -4,8 +4,8 @@ Licensed under the MIT license. --> - + - true + true \ No newline at end of file diff --git a/src/RunTests/build/Microsoft.Build.RunVSTest.targets b/src/RunTests/build/Microsoft.Build.RunVSTest.targets index eeeeb29..e4ff39e 100644 --- a/src/RunTests/build/Microsoft.Build.RunVSTest.targets +++ b/src/RunTests/build/Microsoft.Build.RunVSTest.targets @@ -4,36 +4,36 @@ Licensed under the MIT license. --> - - - - - - - - + + + + + + + +