Skip to content

Commit

Permalink
use vswhere to find mstest path
Browse files Browse the repository at this point in the history
  • Loading branch information
robertpi authored and farlee2121 committed Oct 20, 2024
1 parent 04f7648 commit 7e62c3c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 13 deletions.
20 changes: 7 additions & 13 deletions src/app/Fake.DotNet.Testing.MSTest/MSTest.fs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 = []
Expand Down
1 change: 1 addition & 0 deletions src/app/Fake.DotNet.Testing.MSTest/paket.references
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ group fakemodule

FSharp.Core
NETStandard.Library
BlackFox.VsWhere

0 comments on commit 7e62c3c

Please sign in to comment.