From 62d9fdae198d9f56c253b722b5242f3f9f14dfe1 Mon Sep 17 00:00:00 2001 From: Kirsten Kluge Date: Fri, 22 Apr 2016 23:31:35 +0200 Subject: [PATCH] handle missing options in global.json when using "Specific Runtime" switch --- VSTS.DNX.Tasks.Shared/InstallDNVM.psm1 | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/VSTS.DNX.Tasks.Shared/InstallDNVM.psm1 b/VSTS.DNX.Tasks.Shared/InstallDNVM.psm1 index 39f3072..92e2d41 100644 --- a/VSTS.DNX.Tasks.Shared/InstallDNVM.psm1 +++ b/VSTS.DNX.Tasks.Shared/InstallDNVM.psm1 @@ -41,16 +41,26 @@ $globalJson = Get-Content -Path .\global.json -Raw -ErrorAction Ignore | ConvertFrom-Json -ErrorAction Ignore + $dnxParams = "" + if($globalJson) { Write-Output "Take DNX version from global.json." $dnxVersion = $globalJson.sdk.version - $dnxParams = "" if($SpecificRuntime) { $dnxRuntime = $globalJson.sdk.runtime $dnxArch = $globalJson.sdk.architecture - $dnxParams = "-r $dnxRuntime -a $dnxArch" + + Write-Output " Specific Runtime:" + Write-Output " Runtime: $dnxRuntime" + Write-Output " Architecture: $dnxArch" + + $dnxParams = ( + "{0} {1}" -f + $(If(-Not [string]::IsNullOrWhiteSpace($dnxRuntime)){"-r $dnxRuntime"}), + $(If(-Not [string]::IsNullOrWhiteSpace($dnxArch)){"-a $dnxArch"}) + ) } } else