# 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))
}
}