@@ -85,8 +85,9 @@ Set-Variable -Option Constant "DefaultUserDirectoryName" ".dnx"
85
85
Set-Variable - Option Constant " OldUserDirectoryNames" @ (" .kre" , " .k" )
86
86
Set-Variable - Option Constant " RuntimePackageName" " dnx"
87
87
Set-Variable - Option Constant " DefaultFeed" " https://www.nuget.org/api/v2"
88
- Set-Variable - Option Constant " DefaultUnstableFeed" " https://www.myget.org/F/aspnetrelease /api/v2"
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"
@@ -896,31 +897,26 @@ function dnvm-list {
896
897
function dnvm-alias {
897
898
param (
898
899
[Alias (" d" )]
899
- [Parameter (ParameterSetName = " Delete" , Mandatory = $true )]
900
900
[switch ]$Delete ,
901
901
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
902
[string ]$Name ,
906
-
907
- [Parameter (ParameterSetName = " Write" , Mandatory = $true , Position = 1 )]
903
+
908
904
[string ]$Version ,
909
905
910
906
[Alias (" arch" )]
911
907
[ValidateSet (" " , " x86" , " x64" )]
912
- [Parameter (ParameterSetName = " Write" , Mandatory = $false )]
913
908
[string ]$Architecture = " " ,
914
909
915
910
[Alias (" r" )]
916
911
[ValidateSet (" " , " clr" , " coreclr" )]
917
- [Parameter (ParameterSetName = " Write" )]
918
912
[string ]$Runtime = " " )
919
913
920
- switch ($PSCmdlet.ParameterSetName ) {
921
- " Read" { Read-Alias $Name }
922
- " Write" { Write-Alias $Name $Version - Architecture $Architecture - Runtime $Runtime }
923
- " Delete" { Delete- Alias $Name }
914
+ if ($Version ) {
915
+ Write-Alias $Name $Version - Architecture $Architecture - Runtime $Runtime
916
+ } elseif ($Delete ) {
917
+ Delete- Alias $Name
918
+ } else {
919
+ Read-Alias $Name
924
920
}
925
921
}
926
922
@@ -1124,7 +1120,8 @@ function dnvm-install {
1124
1120
else {
1125
1121
$Architecture = GetArch $Architecture
1126
1122
$Runtime = GetRuntime $Runtime
1127
- $UnpackFolder = Join-Path $RuntimesDir " temp"
1123
+ $TempFolder = Join-Path $RuntimesDir " temp"
1124
+ $UnpackFolder = Join-Path $TempFolder $runtimeFullName
1128
1125
$DownloadFile = Join-Path $UnpackFolder " $runtimeFullName .nupkg"
1129
1126
1130
1127
if (Test-Path $UnpackFolder ) {
@@ -1155,7 +1152,19 @@ function dnvm-install {
1155
1152
else {
1156
1153
_WriteOut " Installing to $RuntimeFolder "
1157
1154
_WriteDebug " Moving package contents to $RuntimeFolder "
1158
- Move-Item $UnpackFolder $RuntimeFolder
1155
+ try {
1156
+ Move-Item $UnpackFolder $RuntimeFolder
1157
+ } catch {
1158
+ if (Test-Path $RuntimeFolder ) {
1159
+ # Attempt to cleanup the runtime folder if it is there after a fail.
1160
+ Remove-Item $RuntimeFolder - Recurse - Force
1161
+ throw
1162
+ }
1163
+ }
1164
+ # If there is nothing left in the temp folder remove it. There could be other installs happening at the same time as this.
1165
+ if (-Not (Test-Path $ (Join-Path $TempFolder " *" ))) {
1166
+ Remove-Item $TempFolder - Recurse
1167
+ }
1159
1168
}
1160
1169
1161
1170
dnvm- use $PackageVersion - Architecture:$Architecture - Runtime:$Runtime - Persistent:$Persistent
@@ -1179,11 +1188,18 @@ function dnvm-install {
1179
1188
else {
1180
1189
_WriteOut " Compiling native images for $runtimeFullName to improve startup performance..."
1181
1190
Write-Progress - Activity " Installing runtime" - Status " Generating runtime native images" - Id 1
1191
+
1192
+ if (Get-Command $CrossGenCommand - ErrorAction SilentlyContinue) {
1193
+ $crossGenCommand = $CrossGenCommand
1194
+ } else {
1195
+ $crossGenCommand = $OldCrossGenCommand
1196
+ }
1197
+
1182
1198
if ($DebugPreference -eq ' SilentlyContinue' ) {
1183
- Start-Process $CrossGenCommand - Wait - WindowStyle Hidden
1199
+ Start-Process $crossGenCommand - Wait - WindowStyle Hidden
1184
1200
}
1185
1201
else {
1186
- Start-Process $CrossGenCommand - Wait - NoNewWindow
1202
+ Start-Process $crossGenCommand - Wait - NoNewWindow
1187
1203
}
1188
1204
_WriteOut " Finished native image compilation."
1189
1205
}
0 commit comments