@@ -67,7 +67,7 @@ function _WriteOut {
67
67
68
68
# ## Constants
69
69
$ProductVersion = " 1.0.0"
70
- $BuildVersion = " beta6-10383 "
70
+ $BuildVersion = " beta6-10393 "
71
71
$Authors = " Microsoft Open Technologies, Inc."
72
72
73
73
# If the Version hasn't been replaced...
@@ -87,13 +87,14 @@ Set-Variable -Option Constant "RuntimePackageName" "dnx"
87
87
Set-Variable - Option Constant " DefaultFeed" " https://www.nuget.org/api/v2"
88
88
Set-Variable - Option Constant " DefaultUnstableFeed" " https://www.myget.org/F/aspnetvnext/api/v2"
89
89
Set-Variable - Option Constant " CrossGenCommand" " dnx-crossgen"
90
+ Set-Variable - Option Constant " OldCrossGenCommand" " k-crossgen"
90
91
Set-Variable - Option Constant " CommandPrefix" " dnvm-"
91
92
Set-Variable - Option Constant " DefaultArchitecture" " x86"
92
93
Set-Variable - Option Constant " DefaultRuntime" " clr"
93
94
Set-Variable - Option Constant " AliasExtension" " .txt"
94
95
95
96
# These are intentionally using "%" syntax. The environment variables are expanded whenever the value is used.
96
- Set-Variable - Option Constant " OldUserHomes" @ (" %USERPROFILE%\.kre" , " %USERPROFILE%\.k" )
97
+ Set-Variable - Option Constant " OldUserHomes" @ (" %USERPROFILE%\.kre" , " %USERPROFILE%\.k" )
97
98
Set-Variable - Option Constant " DefaultUserHome" " %USERPROFILE%\$DefaultUserDirectoryName "
98
99
Set-Variable - Option Constant " HomeEnvVar" " DNX_HOME"
99
100
@@ -678,7 +679,7 @@ function Ngen-Library(
678
679
[Parameter (Mandatory = $true )]
679
680
[string ]$runtimeBin ,
680
681
681
- [ValidateSet (" x86" , " x64" )]
682
+ [ValidateSet (" x86" , " x64" )]
682
683
[Parameter (Mandatory = $true )]
683
684
[string ]$architecture ) {
684
685
@@ -751,7 +752,11 @@ function dnvm-help {
751
752
$Script :ExitCodes = $ExitCodes.UnknownCommand
752
753
return
753
754
}
754
- $help = Get-Help " dnvm-$Command " - ShowWindow:$false
755
+ if ($Host.Version.Major -lt 3 ) {
756
+ $help = Get-Help " dnvm-$Command "
757
+ } else {
758
+ $help = Get-Help " dnvm-$Command " - ShowWindow:$false
759
+ }
755
760
if ($PassThru -Or $Host.Version.Major -lt 3 ) {
756
761
$help
757
762
} else {
@@ -818,7 +823,7 @@ function dnvm-help {
818
823
if ($help.description ) {
819
824
_WriteOut
820
825
_WriteOut - ForegroundColor $ColorScheme.Help_Header " remarks:"
821
- $help.description.Text.Split (@ (" `r " , " `n " ), " RemoveEmptyEntries" ) |
826
+ $help.description.Text.Split (@ (" `r " , " `n " ), " RemoveEmptyEntries" ) |
822
827
ForEach-Object { _WriteOut " $_ " }
823
828
}
824
829
@@ -833,7 +838,11 @@ function dnvm-help {
833
838
_WriteOut - ForegroundColor $ColorScheme.Help_Header " commands: "
834
839
Get-Command " $CommandPrefix *" |
835
840
ForEach-Object {
836
- $h = Get-Help $_.Name - ShowWindow:$false
841
+ if ($Host.Version.MajorVersion -lt 3 ) {
842
+ $h = Get-Help $_.Name
843
+ } else {
844
+ $h = Get-Help $_.Name - ShowWindow:$false
845
+ }
837
846
$name = $_.Name.Substring ($CommandPrefix.Length )
838
847
if ($DeprecatedCommands -notcontains $name ) {
839
848
_WriteOut - NoNewLine " "
@@ -896,31 +905,26 @@ function dnvm-list {
896
905
function dnvm-alias {
897
906
param (
898
907
[Alias (" d" )]
899
- [Parameter (ParameterSetName = " Delete" , Mandatory = $true )]
900
908
[switch ]$Delete ,
901
909
902
- [Parameter (ParameterSetName = " Read" , Mandatory = $false , Position = 0 )]
903
- [Parameter (ParameterSetName = " Write" , Mandatory = $true , Position = 0 )]
904
- [Parameter (ParameterSetName = " Delete" , Mandatory = $true , Position = 0 )]
905
910
[string ]$Name ,
906
-
907
- [Parameter (ParameterSetName = " Write" , Mandatory = $true , Position = 1 )]
911
+
908
912
[string ]$Version ,
909
913
910
914
[Alias (" arch" )]
911
- [ValidateSet (" " , " x86" , " x64" )]
912
- [Parameter (ParameterSetName = " Write" , Mandatory = $false )]
915
+ [ValidateSet (" " , " x86" , " x64" , " arm" )]
913
916
[string ]$Architecture = " " ,
914
917
915
918
[Alias (" r" )]
916
- [ValidateSet (" " , " clr" , " coreclr" )]
917
- [Parameter (ParameterSetName = " Write" )]
919
+ [ValidateSet (" " , " clr" , " coreclr" )]
918
920
[string ]$Runtime = " " )
919
921
920
- switch ($PSCmdlet.ParameterSetName ) {
921
- " Read" { Read-Alias $Name }
922
- " Write" { Write-Alias $Name $Version - Architecture $Architecture - Runtime $Runtime }
923
- " Delete" { Delete- Alias $Name }
922
+ if ($Version ) {
923
+ Write-Alias $Name $Version - Architecture $Architecture - Runtime $Runtime
924
+ } elseif ($Delete ) {
925
+ Delete- Alias $Name
926
+ } else {
927
+ Read-Alias $Name
924
928
}
925
929
}
926
930
@@ -964,12 +968,12 @@ function dnvm-upgrade {
964
968
[string ]$Alias = " default" ,
965
969
966
970
[Alias (" arch" )]
967
- [ValidateSet (" " , " x86" , " x64" )]
971
+ [ValidateSet (" " , " x86" , " x64" , " arm " )]
968
972
[Parameter (Mandatory = $false )]
969
973
[string ]$Architecture = " " ,
970
974
971
975
[Alias (" r" )]
972
- [ValidateSet (" " , " clr" , " coreclr" )]
976
+ [ValidateSet (" " , " clr" , " coreclr" )]
973
977
[Parameter (Mandatory = $false )]
974
978
[string ]$Runtime = " " ,
975
979
@@ -1026,12 +1030,12 @@ function dnvm-install {
1026
1030
[string ]$VersionNuPkgOrAlias ,
1027
1031
1028
1032
[Alias (" arch" )]
1029
- [ValidateSet (" " , " x86" , " x64" )]
1033
+ [ValidateSet (" " , " x86" , " x64" , " arm " )]
1030
1034
[Parameter (Mandatory = $false )]
1031
1035
[string ]$Architecture = " " ,
1032
1036
1033
1037
[Alias (" r" )]
1034
- [ValidateSet (" " , " clr" , " coreclr" )]
1038
+ [ValidateSet (" " , " clr" , " coreclr" )]
1035
1039
[Parameter (Mandatory = $false )]
1036
1040
[string ]$Runtime = " " ,
1037
1041
@@ -1124,7 +1128,8 @@ function dnvm-install {
1124
1128
else {
1125
1129
$Architecture = GetArch $Architecture
1126
1130
$Runtime = GetRuntime $Runtime
1127
- $UnpackFolder = Join-Path $RuntimesDir " temp"
1131
+ $TempFolder = Join-Path $RuntimesDir " temp"
1132
+ $UnpackFolder = Join-Path $TempFolder $runtimeFullName
1128
1133
$DownloadFile = Join-Path $UnpackFolder " $runtimeFullName .nupkg"
1129
1134
1130
1135
if (Test-Path $UnpackFolder ) {
@@ -1155,7 +1160,19 @@ function dnvm-install {
1155
1160
else {
1156
1161
_WriteOut " Installing to $RuntimeFolder "
1157
1162
_WriteDebug " Moving package contents to $RuntimeFolder "
1158
- Move-Item $UnpackFolder $RuntimeFolder
1163
+ try {
1164
+ Move-Item $UnpackFolder $RuntimeFolder
1165
+ } catch {
1166
+ if (Test-Path $RuntimeFolder ) {
1167
+ # Attempt to cleanup the runtime folder if it is there after a fail.
1168
+ Remove-Item $RuntimeFolder - Recurse - Force
1169
+ throw
1170
+ }
1171
+ }
1172
+ # If there is nothing left in the temp folder remove it. There could be other installs happening at the same time as this.
1173
+ if (-Not (Test-Path $ (Join-Path $TempFolder " *" ))) {
1174
+ Remove-Item $TempFolder - Recurse
1175
+ }
1159
1176
}
1160
1177
1161
1178
dnvm- use $PackageVersion - Architecture:$Architecture - Runtime:$Runtime - Persistent:$Persistent
@@ -1179,11 +1196,18 @@ function dnvm-install {
1179
1196
else {
1180
1197
_WriteOut " Compiling native images for $runtimeFullName to improve startup performance..."
1181
1198
Write-Progress - Activity " Installing runtime" - Status " Generating runtime native images" - Id 1
1199
+
1200
+ if (Get-Command $CrossGenCommand - ErrorAction SilentlyContinue) {
1201
+ $crossGenCommand = $CrossGenCommand
1202
+ } else {
1203
+ $crossGenCommand = $OldCrossGenCommand
1204
+ }
1205
+
1182
1206
if ($DebugPreference -eq ' SilentlyContinue' ) {
1183
- Start-Process $CrossGenCommand - Wait - WindowStyle Hidden
1207
+ Start-Process $crossGenCommand - Wait - WindowStyle Hidden
1184
1208
}
1185
1209
else {
1186
- Start-Process $CrossGenCommand - Wait - NoNewWindow
1210
+ Start-Process $crossGenCommand - Wait - NoNewWindow
1187
1211
}
1188
1212
_WriteOut " Finished native image compilation."
1189
1213
}
@@ -1220,12 +1244,12 @@ function dnvm-use {
1220
1244
[string ]$VersionOrAlias ,
1221
1245
1222
1246
[Alias (" arch" )]
1223
- [ValidateSet (" " , " x86" , " x64" )]
1247
+ [ValidateSet (" " , " x86" , " x64" , " arm " )]
1224
1248
[Parameter (Mandatory = $false )]
1225
1249
[string ]$Architecture = " " ,
1226
1250
1227
1251
[Alias (" r" )]
1228
- [ValidateSet (" " , " clr" , " coreclr" )]
1252
+ [ValidateSet (" " , " clr" , " coreclr" )]
1229
1253
[Parameter (Mandatory = $false )]
1230
1254
[string ]$Runtime = " " ,
1231
1255
@@ -1431,11 +1455,7 @@ if(!$cmd) {
1431
1455
try {
1432
1456
if (Get-Command - Name " $CommandPrefix$cmd " - ErrorAction SilentlyContinue) {
1433
1457
_WriteDebug " & 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
- }
1458
+ Invoke-Command ([ScriptBlock ]::Create(" dnvm-$cmd $cmdargs " ))
1439
1459
}
1440
1460
else {
1441
1461
_WriteOut " Unknown command: '$cmd '"
0 commit comments