@@ -295,7 +295,7 @@ function InstallDotNet([string] $dotnetRoot,
295295 if ($runtime -eq " aspnetcore" ) { $runtimePath = $runtimePath + " \Microsoft.AspNetCore.App" }
296296 if ($runtime -eq " windowsdesktop" ) { $runtimePath = $runtimePath + " \Microsoft.WindowsDesktop.App" }
297297 $runtimePath = $runtimePath + " \" + $version
298-
298+
299299 $dotnetVersionLabel = " runtime toolset '$runtime /$architecture v$version '"
300300
301301 if (Test-Path $runtimePath ) {
@@ -547,19 +547,25 @@ function LocateVisualStudio([object]$vsRequirements = $null){
547547 })
548548 }
549549
550- if (! $vsRequirements ) { $vsRequirements = $GlobalJson.tools.vs }
550+ if (! $vsRequirements ) {
551+ if (Get-Member - InputObject $GlobalJson.tools - Name ' vs' - ErrorAction SilentlyContinue) {
552+ $vsRequirements = $GlobalJson.tools.vs
553+ } else {
554+ $vsRequirements = $null
555+ }
556+ }
551557 $args = @ (' -latest' , ' -format' , ' json' , ' -requires' , ' Microsoft.Component.MSBuild' , ' -products' , ' *' )
552558
553559 if (! $excludePrereleaseVS ) {
554560 $args += ' -prerelease'
555561 }
556562
557- if (Get-Member - InputObject $vsRequirements - Name ' version' ) {
563+ if ($vsRequirements -and ( Get-Member - InputObject $vsRequirements - Name ' version' - ErrorAction SilentlyContinue) ) {
558564 $args += ' -version'
559565 $args += $vsRequirements.version
560566 }
561567
562- if (Get-Member - InputObject $vsRequirements - Name ' components' ) {
568+ if ($vsRequirements -and ( Get-Member - InputObject $vsRequirements - Name ' components' - ErrorAction SilentlyContinue) ) {
563569 foreach ($component in $vsRequirements.components ) {
564570 $args += ' -requires'
565571 $args += $component
@@ -610,7 +616,7 @@ function InitializeBuildTool() {
610616 } else {
611617 $initializeBuildToolFramework = $env: _OverrideArcadeInitializeBuildToolFramework
612618 }
613-
619+
614620 $buildTool = @ { Path = $dotnetPath ; Command = ' msbuild' ; Tool = ' dotnet' ; Framework = $initializeBuildToolFramework }
615621 } elseif ($msbuildEngine -eq " vs" ) {
616622 try {
0 commit comments