Changeset 17052 for trunk/Build.ps1


Ignore:
Timestamp:
07/01/19 09:53:48 (8 weeks ago)
Author:
jkarder
Message:

#2875: Updated search for MSBuild location in build script

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Build.ps1

    r16624 r17052  
    11# find ms build
    22$programFilesX86Dir = ($Env:ProgramFiles, ${Env:ProgramFiles(x86)})[[bool]${Env:ProgramFiles(x86)}]
    3 $locations = @(
    4   [System.IO.Path]::Combine($programFilesX86Dir, "Microsoft Visual Studio", "2017", "Enterprise", "MSBuild", "15.0", "Bin", "amd64")
    5   [System.IO.Path]::Combine($programFilesX86Dir, "Microsoft Visual Studio", "2017", "Enterprise", "MSBuild", "15.0", "Bin")
    6   [System.IO.Path]::Combine($programFilesX86Dir, "Microsoft Visual Studio", "2017", "Community", "MSBuild", "15.0", "Bin", "amd64")
    7   [System.IO.Path]::Combine($programFilesX86Dir, "Microsoft Visual Studio", "2017", "Community", "MSBuild", "15.0", "Bin")
    8   [System.IO.Path]::Combine($programFilesX86Dir, "Microsoft Visual Studio", "2017", "BuildTools", "MSBuild", "15.0", "Bin", "amd64"),
    9   [System.IO.Path]::Combine($programFilesX86Dir, "Microsoft Visual Studio", "2017", "BuildTools", "MSBuild", "15.0", "Bin")
    10 )
     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")
    117
    128$msBuildPath = $undefined
    13 Foreach ($loc in $locations) {
    14   $loc = [System.IO.Path]::Combine($loc, "MSBuild.exe")
    15   If ([System.IO.File]::Exists($loc)) {
    16     $msBuildPath = $loc
    17     Break;
     9:search Foreach ($year in $years) {
     10  $loc = [System.IO.Path]::Combine($vsDir, $year)
     11  Foreach ($edition in $editions) {
     12    $edLoc = [System.IO.Path]::Combine($loc, $edition, "MSBuild")
     13    Foreach ($version in $versions) {
     14      $binLoc = [System.IO.Path]::Combine($edLoc, $version, "Bin")
     15      $loc64 = [System.IO.Path]::Combine($binLoc, "amd64", "MSBuild.exe")
     16      $loc32 = [System.IO.Path]::Combine($binLoc, "MSBuild.exe")
     17
     18      If ([System.IO.File]::Exists($loc64)) {
     19        $msBuildPath = $loc64
     20        Break search;
     21      }
     22      If ([System.IO.File]::Exists($loc32)) {
     23        $msBuildPath = $loc32
     24        Break search;
     25      }
     26    }
    1827  }
    1928}
     
    2433    Return
    2534  }
     35
     36  "MSBuild located at `"{0}`"." -f $msBuildPath
    2637
    2738  $curPath = $MyInvocation.MyCommand.Path
Note: See TracChangeset for help on using the changeset viewer.