Changeset 17191
- Timestamp:
- 08/07/19 08:42:01 (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Test.ps1
r17016 r17191 1 1 # find ms build 2 2 $programFilesX86Dir = ($Env:ProgramFiles, ${Env:ProgramFiles(x86)})[[bool]${Env:ProgramFiles(x86)}] 3 $locations = @( 4 [System.IO.Path]::Combine($programFilesX86Dir, "Microsoft Visual Studio", "2017", "Enterprise") 5 [System.IO.Path]::Combine($programFilesX86Dir, "Microsoft Visual Studio", "2017", "Community") 6 [System.IO.Path]::Combine($programFilesX86Dir, "Microsoft Visual Studio", "2017", "BuildTools") 7 ) 3 $vsDir = [System.IO.Path]::Combine($programFilesX86Dir, "Microsoft Visual Studio") 4 $years = @("2019", "2017") 5 $editions = @("Enterprise", "Professional", "Community", "BuildTools") 6 $versions = @("Current", "15.0") 8 7 8 $msBuildPath = $undefined 9 9 $vstestPath = $undefined 10 Foreach ($loc in $locations) { 11 $vstestloc = [System.IO.Path]::Combine($loc, "Common7", "IDE", "CommonExtensions", "Microsoft", "TestWindow", "vstest.console.exe") 12 If([System.IO.File]::Exists($vstestloc)) { 13 $vstestPath = $vstestloc 14 Break; 10 :search Foreach ($year in $years) { 11 $loc = [System.IO.Path]::Combine($vsDir, $year) 12 Foreach ($edition in $editions) { 13 $edLoc = [System.IO.Path]::Combine($loc, $edition, "MSBuild") 14 Foreach ($version in $versions) { 15 $binLoc = [System.IO.Path]::Combine($edLoc, $version, "Bin") 16 $loc64 = [System.IO.Path]::Combine($binLoc, "amd64", "MSBuild.exe") 17 $loc32 = [System.IO.Path]::Combine($binLoc, "MSBuild.exe") 18 19 If ([System.IO.File]::Exists($loc64)) { 20 $msBuildPath = $loc64 21 $vstestPath = [System.IO.Path]::Combine($loc, $edition, "Common7", "IDE", "CommonExtensions", "Microsoft", "TestWindow", "vstest.console.exe") 22 Break search; 23 } 24 If ([System.IO.File]::Exists($loc32)) { 25 $msBuildPath = $loc32 26 $vstestPath = [System.IO.Path]::Combine($loc, $edition, "Common7", "IDE", "CommonExtensions", "Microsoft", "TestWindow", "vstest.console.exe") 27 Break search; 28 } 29 } 15 30 } 16 31 } … … 18 33 If ($vstestPath -eq $undefined) { 19 34 "Could not locate vstest.console.exe, ABORTING ..." 35 Return 36 } 37 38 If(-not [System.IO.File]::Exists($vstestPath)) { 39 "vstest.console.exe is not found at $vstestPath, ABORTING ..." 20 40 Return 21 41 } … … 39 59 40 60 If($dobuild) { 41 42 $msBuildPath = $undefined43 Foreach ($loc in $locations) {44 $msbuildloc64 = [System.IO.Path]::Combine($loc, "MSBuild", "15.0", "Bin", "amd64", "MSBuild.exe")45 $msbuildloc32 = [System.IO.Path]::Combine($loc, "MSBuild", "15.0", "Bin", "MSBuild.exe")46 If ([System.IO.File]::Exists($msbuildloc64)) {47 $msBuildPath = $msbuildloc6448 Break;49 } ElseIf ([System.IO.File]::Exists($msbuildloc32)) {50 $msBuildPath = $msbuildloc3251 Break;52 }53 }54 55 If ($msBuildPath -eq $undefined) {56 "Could not locate MSBuild, ABORTING ..."57 Return58 }59 60 61 $curPath = $MyInvocation.MyCommand.Path 61 62 $curDir = Split-Path $curPath
Note: See TracChangeset
for help on using the changeset viewer.