Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Powershell MSBuild aliases.
Set-Alias MSBuild (Join-Path -Path (Get-ItemProperty "HKLM:\SOFTWARE\Microsoft\MSBuild\ToolsVersions\2.0").MSBuildToolsPath -ChildPath "MSBuild.exe")
Set-Alias MSBuild (Join-Path -Path (Get-ItemProperty "HKLM:\SOFTWARE\Microsoft\MSBuild\ToolsVersions\3.5").MSBuildToolsPath -ChildPath "MSBuild.exe")
Set-Alias MSBuild (Join-Path -Path (Get-ItemProperty "HKLM:\SOFTWARE\Microsoft\MSBuild\ToolsVersions\4.0").MSBuildToolsPath -ChildPath "MSBuild.exe")

This comment has been minimized.

Copy link

gregmac commented Apr 9, 2019

Set to latest (supports v14):

Set-Alias MSBuild (Join-Path -Path (Get-ItemProperty "HKLM:\SOFTWARE\Microsoft\MSBuild\ToolsVersions\$(((Get-ChildItem HKLM:\SOFTWARE\Microsoft\MSBuild\ToolsVersions) | %{ [System.Version]::Parse($_.PSChildName) } |Sort-Object -Descending | select -First 1))").MSBuildToolsPath -ChildPath "MSBuild.exe")

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.