Skip to content

Commit

Permalink
Discover VSTest with VSWhere
Browse files Browse the repository at this point in the history
  • Loading branch information
farlee2121 committed Oct 20, 2024
1 parent 7e62c3c commit 77c8a94
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 9 deletions.
15 changes: 6 additions & 9 deletions src/app/Fake.DotNet.Testing.VSTest/VSTest.fs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

open Fake.Core
open Fake.Testing.Common
open BlackFox.VsWhere
open System
open System.IO
open System.Text
Expand All @@ -12,14 +13,10 @@ open System.Text
[<RequireQualifiedAccess>]
module VSTest =

let private vsTestPaths =
[| @"[ProgramFilesX86]\Microsoft Visual Studio\2019\Community\Common7\IDE\CommonExtensions\Microsoft\TestWindow"
@"[ProgramFilesX86]\Microsoft Visual Studio\2019\Professional\Common7\IDE\CommonExtensions\Microsoft\TestWindow"
@"[ProgramFilesX86]\Microsoft Visual Studio\2019\Enterprise\Common7\IDE\CommonExtensions\Microsoft\TestWindow"
@"[ProgramFilesX86]\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\CommonExtensions\Microsoft\TestWindow"
@"[ProgramFilesX86]\Microsoft Visual Studio 14.0\Common7\IDE\CommonExtensions\Microsoft\TestWindow"
@"[ProgramFilesX86]\Microsoft Visual Studio 12.0\Common7\IDE\CommonExtensions\Microsoft\TestWindow"
@"[ProgramFilesX86]\Microsoft Visual Studio 11.0\Common7\IDE\CommonExtensions\Microsoft\TestWindow" |]
let private guessVSTestPaths () =
let vsTestRelativePath = @"Common7\IDE\CommonExtensions\Microsoft\TestWindow"
VsInstances.getAll ()
|> List.map (fun vs -> Fake.IO.Path.combine vs.InstallationPath vsTestRelativePath)

let private vsTestExe =
if Environment.isMono then
Expand Down Expand Up @@ -115,7 +112,7 @@ module VSTest =
ListLoggers = false
ListSettingsProviders = false
ToolPath =
match ProcessUtils.tryFindFile vsTestPaths vsTestExe with
match ProcessUtils.tryFindFile (guessVSTestPaths ()) vsTestExe with
| Some path -> path
| None -> ""
WorkingDir = null
Expand Down
1 change: 1 addition & 0 deletions src/app/Fake.DotNet.Testing.VSTest/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 77c8a94

Please sign in to comment.