File tree Expand file tree Collapse file tree 1 file changed +6
-5
lines changed Expand file tree Collapse file tree 1 file changed +6
-5
lines changed Original file line number Diff line number Diff line change @@ -56,11 +56,12 @@ function Locate-MSBuildPath($hasVsixExtension = "false") {
5656 $vsInstallPath = Locate- VsInstallPath - hasVsixExtension $hasVsixExtension
5757
5858 # first try to find the VS2019+ path
59- $msbuildPath = Join-Path - path $vsInstallPath - childPath " MSBuild\Current\Bin"
60- $msbuildPath = Resolve-Path $msbuildPath
61-
62- # otherwise fall back to the VS2017 path
63- if (! (Test-Path - path $msbuildPath )) {
59+ try {
60+ $msbuildPath = Join-Path - path $vsInstallPath - childPath " MSBuild\Current\Bin"
61+ $msbuildPath = Resolve-Path $msbuildPath
62+ }
63+ catch {
64+ # Resolve-Path throws if the path does not exist, so use the VS2017 path as a fallback
6465 $msbuildPath = Join-Path - path $vsInstallPath - childPath " MSBuild\$msbuildVersion \Bin"
6566 $msbuildPath = Resolve-Path $msbuildPath
6667 }
You can’t perform that action at this time.
0 commit comments