@@ -59,7 +59,7 @@ function _WriteOut {
59
59
60
60
# ## Constants
61
61
$ProductVersion = " 1.0.0"
62
- $BuildVersion = " beta4-10347 "
62
+ $BuildVersion = " beta5-10350 "
63
63
$Authors = " Microsoft Open Technologies, Inc."
64
64
65
65
# If the Version hasn't been replaced...
@@ -511,7 +511,7 @@ function Unpack-Package([string]$DownloadFile, [string]$UnpackFolder) {
511
511
try {
512
512
# Shell will not recognize nupkg as a zip and throw, so rename it to zip
513
513
$runtimeZip = [System.IO.Path ]::ChangeExtension($DownloadFile , " zip" )
514
- Rename-Item $runtimeFile $runtimeZip
514
+ Rename-Item $DownloadFile $runtimeZip
515
515
# Use the shell to uncompress the nupkg
516
516
$shell_app = new-object - com shell.application
517
517
$zip_file = $shell_app.namespace ($runtimeZip )
@@ -1054,13 +1054,18 @@ function dnvm-install {
1054
1054
}
1055
1055
elseif ($Runtime -eq " coreclr" ) {
1056
1056
if ($NoNative ) {
1057
- _WriteOut " Skipping native image compilation."
1057
+ _WriteOut " Skipping native image compilation."
1058
1058
}
1059
1059
else {
1060
- _WriteOut " Compiling native images for $runtimeFullName to improve startup performance..."
1061
- Write-Progress - Activity " Installing runtime" " Generating runtime native images" - Id 1
1062
- Start-Process $CrossGenCommand - Wait - WindowStyle Hidden
1063
- _WriteOut " Finished native image compilation."
1060
+ _WriteOut " Compiling native images for $runtimeFullName to improve startup performance..."
1061
+ Write-Progress - Activity " Installing runtime" " Generating runtime native images" - Id 1
1062
+ if ($DebugPreference -eq ' SilentlyContinue' ) {
1063
+ Start-Process $CrossGenCommand - Wait - WindowStyle Hidden
1064
+ }
1065
+ else {
1066
+ Start-Process $CrossGenCommand - Wait - NoNewWindow
1067
+ }
1068
+ _WriteOut " Finished native image compilation."
1064
1069
}
1065
1070
}
1066
1071
else {
@@ -1173,6 +1178,40 @@ function dnvm-name {
1173
1178
Get-RuntimeName $VersionOrAlias $Architecture $Runtime
1174
1179
}
1175
1180
1181
+
1182
+ # Checks if a specified file exists in the destination folder and if not, copies the file
1183
+ # to the destination folder.
1184
+ function Safe-Filecopy {
1185
+ param (
1186
+ [Parameter (Mandatory = $true , Position = 0 )] $Filename ,
1187
+ [Parameter (Mandatory = $true , Position = 1 )] $SourceFolder ,
1188
+ [Parameter (Mandatory = $true , Position = 2 )] $DestinationFolder )
1189
+
1190
+ # Make sure the destination folder is created if it doesn't already exist.
1191
+ if (! (Test-Path $DestinationFolder )) {
1192
+ _WriteOut " Creating destination folder '$DestinationFolder ' ... "
1193
+
1194
+ New-Item - Type Directory $Destination | Out-Null
1195
+ }
1196
+
1197
+ $sourceFilePath = Join-Path $SourceFolder $Filename
1198
+ $destFilePath = Join-Path $DestinationFolder $Filename
1199
+
1200
+ if (Test-Path $sourceFilePath ) {
1201
+ _WriteOut " Installing '$Filename ' to '$DestinationFolder ' ... "
1202
+
1203
+ if (Test-Path $destFilePath ) {
1204
+ _WriteOut " Skipping: file already exists" - ForegroundColor Yellow
1205
+ }
1206
+ else {
1207
+ Copy-Item $sourceFilePath $destFilePath - Force
1208
+ }
1209
+ }
1210
+ else {
1211
+ _WriteOut " WARNING: Unable to install: Could not find '$Filename ' in '$SourceFolder '. "
1212
+ }
1213
+ }
1214
+
1176
1215
<#
1177
1216
. SYNOPSIS
1178
1217
Installs the version manager into your User profile directory
@@ -1191,28 +1230,12 @@ function dnvm-setup {
1191
1230
1192
1231
$ScriptFolder = Split-Path - Parent $ScriptPath
1193
1232
1194
- if (! (Test-Path $Destination )) {
1195
- New-Item - Type Directory $Destination | Out-Null
1196
- }
1197
-
1198
- $ps1Command = Join-Path $ScriptFolder " $CommandName .ps1"
1199
- if (Test-Path $ps1Command ) {
1200
- _WriteOut " Installing '$CommandName .ps1' to '$Destination ' ..."
1201
- Copy-Item $ps1Command $Destination - Force
1202
- } else {
1203
- _WriteOut " WARNING: Could not find '$CommandName .ps1' in '$ScriptFolder '. Unable to install!"
1204
- }
1205
- $cmdCommand = Join-Path $ScriptFolder " $CommandName .cmd"
1206
- if (Test-Path $cmdCommand ) {
1207
- _WriteOut " Installing '$CommandName .cmd' to '$Destination ' ..."
1208
- Copy-Item $cmdCommand $Destination - Force
1209
- } else {
1210
- _WriteOut " WARNING: Could not find '$CommandName .cmd' in '$ScriptFolder '. Unable to install!"
1211
- }
1233
+ # Copy script files (if necessary):
1234
+ Safe- Filecopy " $CommandName .ps1" $ScriptFolder $Destination
1235
+ Safe- Filecopy " $CommandName .cmd" $ScriptFolder $Destination
1212
1236
1213
1237
# Configure Environment Variables
1214
1238
# Also, clean old user home values if present
1215
-
1216
1239
# We'll be removing any existing homes, both
1217
1240
$PathsToRemove = @ (
1218
1241
" %USERPROFILE%\$DefaultUserDirectoryName " ,
0 commit comments