From 7e62c3c16e2cf4d015cab0d771b9c9e52470cc5a Mon Sep 17 00:00:00 2001 From: Robert Pickering Date: Thu, 10 Sep 2020 15:10:47 +0200 Subject: [PATCH] use vswhere to find mstest path --- src/app/Fake.DotNet.Testing.MSTest/MSTest.fs | 20 +++++++------------ .../paket.references | 1 + 2 files changed, 8 insertions(+), 13 deletions(-) diff --git a/src/app/Fake.DotNet.Testing.MSTest/MSTest.fs b/src/app/Fake.DotNet.Testing.MSTest/MSTest.fs index 29f2613fc9b..0311b1b5725 100644 --- a/src/app/Fake.DotNet.Testing.MSTest/MSTest.fs +++ b/src/app/Fake.DotNet.Testing.MSTest/MSTest.fs @@ -8,20 +8,14 @@ module MSTest = open System open System.Text + open BlackFox.VsWhere open Fake.Core + open Fake.IO open Fake.Testing.Common - - let internal mstestPaths = - [| @"[ProgramFilesX86]\Microsoft Visual Studio\2019\Enterprise\Common7\IDE\" - @"[ProgramFilesX86]\Microsoft Visual Studio\2019\Professional\Common7\IDE\" - @"[ProgramFilesX86]\Microsoft Visual Studio\2019\Community\Common7\IDE\" - @"[ProgramFilesX86]\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\" - @"[ProgramFilesX86]\Microsoft Visual Studio\2017\Professional\Common7\IDE\" - @"[ProgramFilesX86]\Microsoft Visual Studio\2017\Community\Common7\IDE\" - @"[ProgramFilesX86]\Microsoft Visual Studio 14.0\Common7\IDE" - @"[ProgramFilesX86]\Microsoft Visual Studio 12.0\Common7\IDE" - @"[ProgramFilesX86]\Microsoft Visual Studio 11.0\Common7\IDE" - @"[ProgramFilesX86]\Microsoft Visual Studio 10.0\Common7\IDE" |] + + let private getAllVsPath () = + VsInstances.getWithPackage "Microsoft.VisualStudio.PackageGroup.TestTools.MSTestV2.Managed" false + |> List.map (fun vs -> Path.combine vs.InstallationPath "Common7\\Tools") let internal msTestExe = if Environment.isWindows then @@ -86,7 +80,7 @@ module MSTest = Tests = [] TimeOut = TimeSpan.FromMinutes 5. ToolPath = - match ProcessUtils.tryFindLocalTool "TOOL" msTestExe mstestPaths with + match ProcessUtils.tryFindLocalTool "TOOL" msTestExe (getAllVsPath ()) with | Some path -> path | None -> "" Details = [] diff --git a/src/app/Fake.DotNet.Testing.MSTest/paket.references b/src/app/Fake.DotNet.Testing.MSTest/paket.references index a8342f4b742..34fc6a37d04 100644 --- a/src/app/Fake.DotNet.Testing.MSTest/paket.references +++ b/src/app/Fake.DotNet.Testing.MSTest/paket.references @@ -2,3 +2,4 @@ group fakemodule FSharp.Core NETStandard.Library +BlackFox.VsWhere