1
- # Requires -Version 3
1
+ # Requires -Version 2
2
2
3
3
if (Test-Path env:WEBSITE_SITE_NAME)
4
4
{
@@ -252,7 +252,7 @@ function Safe-Filecopy {
252
252
}
253
253
254
254
function GetArch ($Architecture , $FallBackArch = $DefaultArchitecture ) {
255
- if (! [String ]::IsNullOrWhiteSpace ($Architecture )) {
255
+ if (! [String ]::IsNullOrEmpty ($Architecture )) {
256
256
$Architecture
257
257
} elseif ($CompatArch ) {
258
258
$CompatArch
@@ -262,7 +262,7 @@ function GetArch($Architecture, $FallBackArch = $DefaultArchitecture) {
262
262
}
263
263
264
264
function GetRuntime ($Runtime ) {
265
- if (! [String ]::IsNullOrWhiteSpace ($Runtime )) {
265
+ if (! [String ]::IsNullOrEmpty ($Runtime )) {
266
266
$Runtime
267
267
} else {
268
268
$DefaultRuntime
@@ -560,7 +560,7 @@ function Download-Package(
560
560
}
561
561
}
562
562
563
- Write-Progress - Activity (" Downloading $RuntimeShortFriendlyName from $url " ) - Id 2 - ParentId 1 - Completed
563
+ Write-Progress - Status " Done " - Activity (" Downloading $RuntimeShortFriendlyName from $url " ) - Id 2 - ParentId 1 - Completed
564
564
}
565
565
finally {
566
566
Remove-Variable downloadData - Scope " Global"
@@ -632,10 +632,10 @@ function Change-Path() {
632
632
633
633
$newPath = $prependPath
634
634
foreach ($portion in $existingPaths.Split (' ;' )) {
635
- if (! [string ]::IsNullOrWhiteSpace ($portion )) {
635
+ if (! [string ]::IsNullOrEmpty ($portion )) {
636
636
$skip = $portion -eq " "
637
637
foreach ($removePath in $removePaths ) {
638
- if (! [string ]::IsNullOrWhiteSpace ($removePath )) {
638
+ if (! [string ]::IsNullOrEmpty ($removePath )) {
639
639
$removePrefix = if ($removePath.EndsWith (" \" )) { $removePath } else { " $removePath \" }
640
640
641
641
if ($removePath -and (($portion -eq $removePath ) -or ($portion.StartsWith ($removePrefix )))) {
@@ -645,7 +645,7 @@ function Change-Path() {
645
645
}
646
646
}
647
647
if (! $skip ) {
648
- if (! [String ]::IsNullOrWhiteSpace ($newPath )) {
648
+ if (! [String ]::IsNullOrEmpty ($newPath )) {
649
649
$newPath += " ;"
650
650
}
651
651
$newPath += $portion
@@ -752,7 +752,7 @@ function dnvm-help {
752
752
return
753
753
}
754
754
$help = Get-Help " dnvm-$Command "
755
- if ($PassThru ) {
755
+ if ($PassThru -Or $Host .Version.Major -lt 3 ) {
756
756
$help
757
757
} else {
758
758
_WriteOut - ForegroundColor $ColorScheme.Help_Header " $CommandName $Command "
@@ -1084,7 +1084,7 @@ function dnvm-install {
1084
1084
}
1085
1085
1086
1086
if ($VersionNuPkgOrAlias -eq " latest" ) {
1087
- Write-Progress - Activity " Installing runtime " " Determining latest runtime" - Id 1
1087
+ Write-Progress - Status " Determining Latest Runtime " - Activity " Installing runtime" - Id 1
1088
1088
$VersionNuPkgOrAlias = Find-Latest $Runtime $Architecture - Feed:$selectedFeed
1089
1089
}
1090
1090
@@ -1094,7 +1094,7 @@ function dnvm-install {
1094
1094
if (! (Test-Path $VersionNuPkgOrAlias )) {
1095
1095
throw " Unable to locate package file: '$VersionNuPkgOrAlias '"
1096
1096
}
1097
- Write-Progress - Activity " Installing runtime" " Parsing package file name" - Id 1
1097
+ Write-Progress - Activity " Installing runtime" - Status " Parsing package file name" - Id 1
1098
1098
$runtimeFullName = [System.IO.Path ]::GetFileNameWithoutExtension($VersionNuPkgOrAlias )
1099
1099
$Architecture = Get-PackageArch $runtimeFullName
1100
1100
$Runtime = Get-PackageRuntime $runtimeFullName
@@ -1134,18 +1134,18 @@ function dnvm-install {
1134
1134
New-Item - Type Directory $UnpackFolder | Out-Null
1135
1135
1136
1136
if ($IsNuPkg ) {
1137
- Write-Progress - Activity " Installing runtime" " Copying package" - Id 1
1137
+ Write-Progress - Activity " Installing runtime" - Status " Copying package" - Id 1
1138
1138
_WriteDebug " Copying local nupkg $VersionNuPkgOrAlias to $DownloadFile "
1139
1139
Copy-Item $VersionNuPkgOrAlias $DownloadFile
1140
1140
} else {
1141
1141
# Download the package
1142
- Write-Progress - Activity " Installing runtime" " Downloading runtime" - Id 1
1142
+ Write-Progress - Activity " Installing runtime" - Status " Downloading runtime" - Id 1
1143
1143
_WriteDebug " Downloading version $VersionNuPkgOrAlias to $DownloadFile "
1144
1144
1145
1145
Download- Package $PackageVersion $Architecture $Runtime $DownloadFile - Proxy:$Proxy - Feed:$selectedFeed
1146
1146
}
1147
1147
1148
- Write-Progress - Activity " Installing runtime" " Unpacking runtime" - Id 1
1148
+ Write-Progress - Activity " Installing runtime" - Status " Unpacking runtime" - Id 1
1149
1149
Unpack- Package $DownloadFile $UnpackFolder
1150
1150
1151
1151
if (Test-Path $RuntimeFolder ) {
@@ -1164,7 +1164,7 @@ function dnvm-install {
1164
1164
if (-not $NoNative ) {
1165
1165
if ((Is- Elevated) -or $Ngen ) {
1166
1166
$runtimeBin = Get-RuntimePath $runtimeFullName
1167
- Write-Progress - Activity " Installing runtime" " Generating runtime native images" - Id 1
1167
+ Write-Progress - Activity " Installing runtime" - Status " Generating runtime native images" - Id 1
1168
1168
Ngen- Library $runtimeBin $Architecture
1169
1169
}
1170
1170
else {
@@ -1178,7 +1178,7 @@ function dnvm-install {
1178
1178
}
1179
1179
else {
1180
1180
_WriteOut " Compiling native images for $runtimeFullName to improve startup performance..."
1181
- Write-Progress - Activity " Installing runtime" " Generating runtime native images" - Id 1
1181
+ Write-Progress - Activity " Installing runtime" - Status " Generating runtime native images" - Id 1
1182
1182
if ($DebugPreference -eq ' SilentlyContinue' ) {
1183
1183
Start-Process $CrossGenCommand - Wait - WindowStyle Hidden
1184
1184
}
@@ -1198,7 +1198,7 @@ function dnvm-install {
1198
1198
dnvm- alias $Alias $PackageVersion - Architecture:$Architecture - Runtime:$Runtime
1199
1199
}
1200
1200
1201
- Write-Progress - Activity " Install complete" - Id 1 - Complete
1201
+ Write-Progress - Status " Done " - Activity " Install complete" - Id 1 - Complete
1202
1202
}
1203
1203
1204
1204
@@ -1431,7 +1431,11 @@ if(!$cmd) {
1431
1431
try {
1432
1432
if (Get-Command - Name " $CommandPrefix$cmd " - ErrorAction SilentlyContinue) {
1433
1433
_WriteDebug " & dnvm-$cmd $cmdargs "
1434
- & " dnvm-$cmd " @cmdargs
1434
+ if ($host.Version.Major -lt 3 ) {
1435
+ Invoke-Command ([ScriptBlock ]::Create(" dnvm-$cmd $cmdargs " ))
1436
+ } else {
1437
+ & " dnvm-$cmd " @cmdargs
1438
+ }
1435
1439
}
1436
1440
else {
1437
1441
_WriteOut " Unknown command: '$cmd '"
0 commit comments