PoshCode Archive  Artifact [45fb2deef1]

Artifact 45fb2deef10c461d6577a5280ef6421e74fca95d4a5c2e975656de0d2a5526b8:

  • File Alias-latest-msbuild.ps1 — part of check-in [1a90f28d87] at 2018-06-10 14:26:12 on branch trunk — This is just a little trick I use to find InstallUtil and MsBuild, and make sure I’m using the latest version of them. (user: unknown size: 1036)

# encoding: ascii
# api: powershell
# title: Alias latest msbuild
# description: This is just a little trick I use to find InstallUtil and MsBuild, and make sure I’m using the latest version of them.
# version: 0.1
# license: CC0
# x-poshcode-id: 896
# x-archived: 2009-03-01T00:15:51
#
#
## Because of Split-Path, I get the "Framework" folder path (one level above the versioned folders)
$rtr = Split-Path $([System.Runtime.InteropServices.RuntimeEnvironment]::GetRuntimeDirectory())

## Then I loop through them in ascending (numerical, but really ascii) order
## each time I find installutil or mdbuild, I update the alias to point at the newer version
foreach($rtd in get-childitem $rtr -filt v* | sort Name) {
   if( Test-Path (join-path $rtd.FullName installutil.exe) ) {
      set-alias installutil (resolve-path (join-path $rtd.FullName installutil.exe))
   }
   if( Test-Path (join-path $rtd.FullName msbuild.exe) ) {
      set-alias msbuild (resolve-path (join-path $rtd.FullName msbuild.exe))
   }
}