@@ -67,7 +67,7 @@ function _WriteOut {
67
67
68
68
# ## Constants
69
69
$ProductVersion = " 1.0.0"
70
- $BuildVersion = " beta6-10383 "
70
+ $BuildVersion = " beta6-10386 "
71
71
$Authors = " Microsoft Open Technologies, Inc."
72
72
73
73
# If the Version hasn't been replaced...
@@ -87,6 +87,7 @@ 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"
@@ -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 {
@@ -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
915
[ValidateSet (" " , " x86" , " x64" )]
912
- [Parameter (ParameterSetName = " Write" , Mandatory = $false )]
913
916
[string ]$Architecture = " " ,
914
917
915
918
[Alias (" r" )]
916
919
[ValidateSet (" " , " clr" , " coreclr" )]
917
- [Parameter (ParameterSetName = " Write" )]
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
@@ -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
}
0 commit comments