Skip to content

Commit 1dd1411

Browse files
committed
Merge remote-tracking branch 'upstream/dev' into dev
2 parents a89847f + 315abc2 commit 1dd1411

File tree

5 files changed

+61
-43
lines changed

5 files changed

+61
-43
lines changed

GettingStartedDeb.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ sudo ldconfig
9797
Now let's get DNVM. To do this run:
9898

9999
```
100+
sudo apt-get install unzip
100101
curl -sSL https://raw.githubusercontent.com/aspnet/Home/dev/dnvminstall.sh | DNX_BRANCH=dev sh && source ~/.dnx/dnvm/dnvm.sh
101102
```
102103

dnvm.ps1

Lines changed: 55 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ function _WriteOut {
6767

6868
### Constants
6969
$ProductVersion="1.0.0"
70-
$BuildVersion="beta6-10383"
70+
$BuildVersion="beta6-10393"
7171
$Authors="Microsoft Open Technologies, Inc."
7272

7373
# If the Version hasn't been replaced...
@@ -87,13 +87,14 @@ Set-Variable -Option Constant "RuntimePackageName" "dnx"
8787
Set-Variable -Option Constant "DefaultFeed" "https://www.nuget.org/api/v2"
8888
Set-Variable -Option Constant "DefaultUnstableFeed" "https://www.myget.org/F/aspnetvnext/api/v2"
8989
Set-Variable -Option Constant "CrossGenCommand" "dnx-crossgen"
90+
Set-Variable -Option Constant "OldCrossGenCommand" "k-crossgen"
9091
Set-Variable -Option Constant "CommandPrefix" "dnvm-"
9192
Set-Variable -Option Constant "DefaultArchitecture" "x86"
9293
Set-Variable -Option Constant "DefaultRuntime" "clr"
9394
Set-Variable -Option Constant "AliasExtension" ".txt"
9495

9596
# 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")
9798
Set-Variable -Option Constant "DefaultUserHome" "%USERPROFILE%\$DefaultUserDirectoryName"
9899
Set-Variable -Option Constant "HomeEnvVar" "DNX_HOME"
99100

@@ -678,7 +679,7 @@ function Ngen-Library(
678679
[Parameter(Mandatory=$true)]
679680
[string]$runtimeBin,
680681

681-
[ValidateSet("x86","x64")]
682+
[ValidateSet("x86", "x64")]
682683
[Parameter(Mandatory=$true)]
683684
[string]$architecture) {
684685

@@ -751,7 +752,11 @@ function dnvm-help {
751752
$Script:ExitCodes = $ExitCodes.UnknownCommand
752753
return
753754
}
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+
}
755760
if($PassThru -Or $Host.Version.Major -lt 3) {
756761
$help
757762
} else {
@@ -818,7 +823,7 @@ function dnvm-help {
818823
if($help.description) {
819824
_WriteOut
820825
_WriteOut -ForegroundColor $ColorScheme.Help_Header "remarks:"
821-
$help.description.Text.Split(@("`r","`n"), "RemoveEmptyEntries") |
826+
$help.description.Text.Split(@("`r", "`n"), "RemoveEmptyEntries") |
822827
ForEach-Object { _WriteOut " $_" }
823828
}
824829

@@ -833,7 +838,11 @@ function dnvm-help {
833838
_WriteOut -ForegroundColor $ColorScheme.Help_Header "commands: "
834839
Get-Command "$CommandPrefix*" |
835840
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+
}
837846
$name = $_.Name.Substring($CommandPrefix.Length)
838847
if($DeprecatedCommands -notcontains $name) {
839848
_WriteOut -NoNewLine " "
@@ -896,31 +905,26 @@ function dnvm-list {
896905
function dnvm-alias {
897906
param(
898907
[Alias("d")]
899-
[Parameter(ParameterSetName="Delete",Mandatory=$true)]
900908
[switch]$Delete,
901909

902-
[Parameter(ParameterSetName="Read",Mandatory=$false,Position=0)]
903-
[Parameter(ParameterSetName="Write",Mandatory=$true,Position=0)]
904-
[Parameter(ParameterSetName="Delete",Mandatory=$true,Position=0)]
905910
[string]$Name,
906-
907-
[Parameter(ParameterSetName="Write",Mandatory=$true,Position=1)]
911+
908912
[string]$Version,
909913

910914
[Alias("arch")]
911-
[ValidateSet("", "x86","x64")]
912-
[Parameter(ParameterSetName="Write", Mandatory=$false)]
915+
[ValidateSet("", "x86", "x64", "arm")]
913916
[string]$Architecture = "",
914917

915918
[Alias("r")]
916-
[ValidateSet("", "clr","coreclr")]
917-
[Parameter(ParameterSetName="Write")]
919+
[ValidateSet("", "clr", "coreclr")]
918920
[string]$Runtime = "")
919921

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
924928
}
925929
}
926930

@@ -964,12 +968,12 @@ function dnvm-upgrade {
964968
[string]$Alias = "default",
965969

966970
[Alias("arch")]
967-
[ValidateSet("", "x86","x64")]
971+
[ValidateSet("", "x86", "x64", "arm")]
968972
[Parameter(Mandatory=$false)]
969973
[string]$Architecture = "",
970974

971975
[Alias("r")]
972-
[ValidateSet("", "clr","coreclr")]
976+
[ValidateSet("", "clr", "coreclr")]
973977
[Parameter(Mandatory=$false)]
974978
[string]$Runtime = "",
975979

@@ -1026,12 +1030,12 @@ function dnvm-install {
10261030
[string]$VersionNuPkgOrAlias,
10271031

10281032
[Alias("arch")]
1029-
[ValidateSet("", "x86","x64")]
1033+
[ValidateSet("", "x86", "x64", "arm")]
10301034
[Parameter(Mandatory=$false)]
10311035
[string]$Architecture = "",
10321036

10331037
[Alias("r")]
1034-
[ValidateSet("", "clr","coreclr")]
1038+
[ValidateSet("", "clr", "coreclr")]
10351039
[Parameter(Mandatory=$false)]
10361040
[string]$Runtime = "",
10371041

@@ -1124,7 +1128,8 @@ function dnvm-install {
11241128
else {
11251129
$Architecture = GetArch $Architecture
11261130
$Runtime = GetRuntime $Runtime
1127-
$UnpackFolder = Join-Path $RuntimesDir "temp"
1131+
$TempFolder = Join-Path $RuntimesDir "temp"
1132+
$UnpackFolder = Join-Path $TempFolder $runtimeFullName
11281133
$DownloadFile = Join-Path $UnpackFolder "$runtimeFullName.nupkg"
11291134

11301135
if(Test-Path $UnpackFolder) {
@@ -1155,7 +1160,19 @@ function dnvm-install {
11551160
else {
11561161
_WriteOut "Installing to $RuntimeFolder"
11571162
_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+
}
11591176
}
11601177

11611178
dnvm-use $PackageVersion -Architecture:$Architecture -Runtime:$Runtime -Persistent:$Persistent
@@ -1179,11 +1196,18 @@ function dnvm-install {
11791196
else {
11801197
_WriteOut "Compiling native images for $runtimeFullName to improve startup performance..."
11811198
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+
11821206
if ($DebugPreference -eq 'SilentlyContinue') {
1183-
Start-Process $CrossGenCommand -Wait -WindowStyle Hidden
1207+
Start-Process $crossGenCommand -Wait -WindowStyle Hidden
11841208
}
11851209
else {
1186-
Start-Process $CrossGenCommand -Wait -NoNewWindow
1210+
Start-Process $crossGenCommand -Wait -NoNewWindow
11871211
}
11881212
_WriteOut "Finished native image compilation."
11891213
}
@@ -1220,12 +1244,12 @@ function dnvm-use {
12201244
[string]$VersionOrAlias,
12211245

12221246
[Alias("arch")]
1223-
[ValidateSet("", "x86","x64")]
1247+
[ValidateSet("", "x86", "x64", "arm")]
12241248
[Parameter(Mandatory=$false)]
12251249
[string]$Architecture = "",
12261250

12271251
[Alias("r")]
1228-
[ValidateSet("", "clr","coreclr")]
1252+
[ValidateSet("", "clr", "coreclr")]
12291253
[Parameter(Mandatory=$false)]
12301254
[string]$Runtime = "",
12311255

@@ -1431,11 +1455,7 @@ if(!$cmd) {
14311455
try {
14321456
if(Get-Command -Name "$CommandPrefix$cmd" -ErrorAction SilentlyContinue) {
14331457
_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"))
14391459
}
14401460
else {
14411461
_WriteOut "Unknown command: '$cmd'"

dnvm.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# Source this file from your .bash-profile or script to use
33

44
# "Constants"
5-
_DNVM_BUILDNUMBER="beta6-10383"
5+
_DNVM_BUILDNUMBER="beta6-10393"
66
_DNVM_AUTHORS="Microsoft Open Technologies, Inc."
77
_DNVM_RUNTIME_PACKAGE_NAME="dnx"
88
_DNVM_RUNTIME_FRIENDLY_NAME=".NET Execution Environment"
@@ -208,7 +208,7 @@ __dnvm_unpack() {
208208

209209
#Set shell commands as executable
210210
find "$runtimeFolder/bin/" -type f \
211-
-exec sh -c "head -c 11 {} | grep '/bin/bash' > /dev/null" \; -print | xargs chmod 775
211+
-exec sh -c "head -c 20 {} | grep '/usr/bin/env bash\|/bin/bash' > /dev/null" \; -print | xargs chmod 775
212212

213213
#Set dnx to be executable
214214
chmod 775 "$runtimeFolder/bin/dnx"
@@ -413,7 +413,7 @@ dnvm()
413413
fi
414414

415415
if [[ $arch == "x86" && $runtime == "coreclr" ]]; then
416-
printf "%b\n" "${Red}Core CLR doesn't currently have a 32 bit build. You must use x64."
416+
printf "%b\n" "${Red}Core CLR doesn't currently have a 32 bit build. You must use x64.${RCol}"
417417
return 1
418418
fi
419419

dnvminstall.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/bin/bash
1+
#!/usr/bin/env bash
22

33
_dnvmsetup_has() {
44
type "$1" > /dev/null 2>&1

samples/latest/HelloMvc/Startup.cs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,7 @@ public void Configure(IApplicationBuilder app)
1414
{
1515
app.UseErrorPage();
1616

17-
app.UseMvc(routes =>
18-
{
19-
routes.MapRoute("default", "{controller=Home}/{action=Index}/{id?}");
20-
});
17+
app.UseMvcWithDefaultRoute();
2118

2219
app.UseWelcomePage();
2320
}

0 commit comments

Comments
 (0)