From 39fd4bbedf1b694eeec211fd1a8e359a7ed68755 Mon Sep 17 00:00:00 2001 From: Glenn Condron Date: Thu, 8 May 2014 13:43:11 -0700 Subject: [PATCH 1/5] Update samples to the latest packages --- kvm.cmd | 189 +------ kvm.ps1 | 533 ++++++++++++++++++ kvmsetup.cmd | 1 + samples/ConsoleApp/project.json | 20 +- .../ConsoleApp/project.json.140508133553.bak | 9 + samples/HelloWeb/Startup.cs | 3 +- samples/HelloWeb/project.json | 49 +- .../HelloWeb/project.json.140508133915.bak | 16 + samples/HelloWebFx/Startup.cs | 8 +- samples/HelloWebFx/project.json | 67 +-- .../HelloWebFx/project.json.140508133950.bak | 19 + 11 files changed, 630 insertions(+), 284 deletions(-) create mode 100644 kvm.ps1 create mode 100644 kvmsetup.cmd create mode 100644 samples/ConsoleApp/project.json.140508133553.bak create mode 100644 samples/HelloWeb/project.json.140508133915.bak create mode 100644 samples/HelloWebFx/project.json.140508133950.bak diff --git a/kvm.cmd b/kvm.cmd index 7b73752a4fa1..557550bd8030 100644 --- a/kvm.cmd +++ b/kvm.cmd @@ -1,187 +1,8 @@ -@ECHO OFF -IF "%1"=="" ( - CALL :cmd_help -) ELSE ( - CALL :cmd_%1 %* - IF ERRORLEVEL 1 CALL:cmd_help -) -GOTO:EOF - - -:cmd_setup -SET "_KVM_PATH=%USERPROFILE%\.k\" -SET "_TEMP_PATH=%PATH%" - -IF /I NOT "%~dp0"=="%_KVM_PATH%" ( - IF NOT EXIST "%_KVM_PATH%" MKDIR "%_KVM_PATH%" - COPY "%~f0" "%_KVM_PATH%kvm.cmd" -) - -:PARSE_START -@IF "%_TEMP_PATH%"=="" GOTO PARSE_END -@FOR /F "tokens=1* delims=;" %%a in ("%_TEMP_PATH%") Do @IF "%%a"=="%_KVM_PATH%" GOTO:end_setup -@FOR /F "tokens=1* delims=;" %%a in ("%_TEMP_PATH%") Do @SET _TEMP_PATH=%%b -@GOTO PARSE_START -:PARSE_END - -SET "PATH=%PATH%;%_KVM_PATH%" -powershell -NoProfile -ExecutionPolicy unrestricted -Command "[Environment]::SetEnvironmentVariable('PATH',[Environment]::GetEnvironmentVariable('PATH','user')+';%_KVM_PATH%','user');" - - -:end_setup -CALL "%_KVM_PATH%kvm.cmd" upgrade -@ECHO Running crossgen, see crossgen.log for results -CALL "%_KVM_PATH%k.cmd" crossgen >crossgen.log 2>crossgen.err.log -SET _KVM_PATH= -SET _TEMP_PATH= -GOTO:EOF - - -:cmd_upgrade -CALL:cmd_install install -CALL:cmd_alias alias default %_KVM_VERSION% -GOTO:EOF - - -:cmd_install -IF NOT EXIST "%~dp0.nuget\NuGet.exe" ( - IF NOT EXIST "%~dp0.nuget" MKDIR "%~dp0.nuget" - ECHO Downloading latest version of NuGet.exe... - @powershell -NoProfile -ExecutionPolicy unrestricted -Command "((new-object net.webclient).DownloadFile('https://nuget.org/nuget.exe', '%~dp0.nuget\NuGet.exe'))" -) - -IF NOT EXIST "%~dp0.nuget\NuGet.config" ( -echo ^ >"%~dp0.nuget\NuGet.config" -echo ^ >>"%~dp0.nuget\NuGet.config" -echo ^ >>"%~dp0.nuget\NuGet.config" -echo ^ >>"%~dp0.nuget\NuGet.config" -echo ^ >>"%~dp0.nuget\NuGet.config" -echo ^ >>"%~dp0.nuget\NuGet.config" -echo ^ >>"%~dp0.nuget\NuGet.config" -echo ^ >>"%~dp0.nuget\NuGet.config" -echo ^ >>"%~dp0.nuget\NuGet.config" -echo ^ >>"%~dp0.nuget\NuGet.config" -echo ^ >>"%~dp0.nuget\NuGet.config" -) - -IF "%2"=="" ( - echo Finding latest version - FOR /f "tokens=1,2" %%G in ('"%~dp0.nuget\NuGet.exe" list ProjectK -Prerelease -ConfigFile %~dp0.nuget\NuGet.config') DO ( - IF "%%G"=="ProjectK" ( - SET _KVM_VERSION=%%H - ) - ) -) ELSE ( - SET "_KVM_VERSION=%2" -) - -ECHO Downloading version %_KVM_VERSION% -"%~dp0.nuget\NuGet.exe" install ProjectK -Version %_KVM_VERSION% -OutputDirectory "%~dp0packages" -ConfigFile "%~dp0.nuget\NuGet.config" +@Echo off -CALL:cmd_use use %_KVM_VERSION% -GOTO:EOF +PowerShell -NoProfile -NoLogo -ExecutionPolicy unrestricted -Command "[System.Threading.Thread]::CurrentThread.CurrentCulture = ''; [System.Threading.Thread]::CurrentThread.CurrentUICulture = '';& '%~dp0kvm.ps1' %*" - -:cmd_use -IF NOT EXIST "%~dp0k.cmd" ( - ECHO @CALL %%~dp0kvm.cmd k %%* >%~dp0k.cmd -) -IF EXIST "%~dp0alias\%2.txt" ( - FOR /F %%G IN (%~dp0alias\%2.txt) DO ( - ECHO Setting _KVM_VERSION to '%%G' - SET "_KVM_VERSION=%%G" - ) -) ELSE ( - IF NOT EXIST "%~dp0packages\ProjectK.%2\tools\k.cmd" ( - ECHO Version '%2' not found. - ECHO You may need to run 'kvm install %2' - GOTO:EOF - ) - ECHO Setting _KVM_VERSION to '%2' - SET "_KVM_VERSION=%2" -) -GOTO:EOF - - -:cmd_alias -IF NOT EXIST "%~dp0alias" ( - MKDIR "%~dp0alias" +IF EXIST "%USERPROFILE%\.kre\run-once.cmd" ( + CALL "%USERPROFILE%\.kre\run-once.cmd" + DEL "%USERPROFILE%\.kre\run-once.cmd" ) -IF "%3"=="" ( - IF "%2"=="" ( - DIR "%~dp0alias" /b - ) ELSE ( - ECHO Alias '%2' is - TYPE "%~dp0alias\%2.txt" - ) -) ELSE ( - IF NOT EXIST "%~dp0packages\ProjectK.%3\tools\k.cmd" ( - ECHO Version '%3' not found. - ECHO You may need to run 'kvm install %3' - GOTO:EOF - ) - - ECHO Setting alias '%2' to '%3' - ECHO %3>%~dp0alias\%2.txt -) -GOTO:EOF - - -:cmd_list -dir /b "%~dp0packages\ProjectK*" -GOTO:EOF - - -:cmd_k -@REM find k.cmd in local paths - -@REM read _KVM_VERSION.txt if _KVM_VERSION not set -IF "%_KVM_VERSION%" == "" ( - FOR /F %%G IN (%~dp0alias\default.txt) DO ( - SET "_KVM_VERSION=%%G" - ) -) -IF NOT EXIST "%~dp0packages\ProjectK.%_KVM_VERSION%\tools\k.cmd" ( - ECHO Version '%_KVM_VERSION%' not found. - ECHO You may need to run 'kvm install %_KVM_VERSION%' -) ELSE ( - CALL "%~dp0packages\ProjectK.%_KVM_VERSION%\tools\k.cmd" %2 %3 %4 %5 %6 %7 %8 %9 -) -GOTO:EOF - - -:cmd_help -ECHO kvm ^ [args...] -ECHO k version manager -ECHO . -ECHO kvm help -ECHO displays this help -ECHO . -ECHO kvm upgrade -ECHO install latest k version and make it the default -ECHO . -ECHO kvm install ^ -ECHO install and use specific k version -ECHO . -ECHO kvm list -ECHO list installed k versions -ECHO . -ECHO kvm use ^^|^ -ECHO use a version or alias within the current command prompt -ECHO . -ECHO kvm alias ^ ^ -ECHO create alias to a specific version -ECHO alias names may be passed to 'kvm use ^' -ECHO the alias 'default' determines the default k version -ECHO when kvm use is not called -ECHO . -ECHO kvm alias ^ -ECHO show the version of an alias -ECHO . -ECHO kvm alias -ECHO list aliases -ECHO . - -GOTO:EOF - - diff --git a/kvm.ps1 b/kvm.ps1 new file mode 100644 index 000000000000..822bddc22278 --- /dev/null +++ b/kvm.ps1 @@ -0,0 +1,533 @@ +param( + [parameter(Position=0)] + [string] $command, + [switch] $verbosity = $false, + [alias("g")][switch] $global = $false, + [alias("p")][switch] $persistent = $false, + [switch] $x86 = $false, + [switch] $x64 = $false, + [switch] $svr50 = $false, + [switch] $svrc50 = $false, + [parameter(Position=1, ValueFromRemainingArguments=$true)] + [string[]]$args=@() +) + +$userKrePath = $env:USERPROFILE + "\.kre" +$userKrePackages = $userKrePath + "\packages" +$globalKrePath = $env:ProgramFiles + "\KRE" +$globalKrePackages = $globalKrePath + "\packages" + +$scriptPath = $myInvocation.MyCommand.Definition + +function Kvm-Help { +@" +K Runtime Environment Version Manager - Build {{BUILD_NUMBER}} + +USAGE: kvm [options] + +kvm upgrade [-x86][-x64] [-svr50][-svrc50] [-g|-global] + install latest KRE from feed + set 'default' alias to installed version + add KRE bin to user PATH environment variable persistently + -g|-global install to machine-wide location + +kvm install || [-x86][-x64] [-svr50][-svrc50] [-g|-global] + install requested KRE from feed + add KRE bin to path of current command line + -g|-global install to machine-wide location + +kvm use ||none [-x86][-x64] [-svr50][-svrc50] [-p|-persistent] [-g|-global] + | add KRE bin to path of current command line + none remove KRE bin from path of current command line + -p|-persistent add KRE bin to PATH environment variables persistently + -g|-global combined with -p to change machine PATH instead of user PATH + +kvm list + list KRE versions installed + +kvm alias + list KRE aliases which have been defined + +kvm alias + display value of named alias + +kvm alias [-x86][-x64] [-svr50][-svrc50] + set alias to specific version + +"@ | Write-Host +} + +function Kvm-Global-Setup { + If (Needs-Elevation) + { + $arguments = "& '$scriptPath' setup $(Requested-Switches) -persistent" + Start-Process "$psHome\powershell.exe" -Verb runAs -ArgumentList $arguments -Wait + Write-Host "Setup complete" + Kvm-Alias-List + Kvm-List + break + } + + $scriptFolder = [System.IO.Path]::GetDirectoryName($scriptPath) + + $kvmBinPath = "$userKrePath\bin" + + Write-Host "Copying file $kvmBinPath\kvm.ps1" + md $kvmBinPath -Force | Out-Null + copy "$scriptFolder\kvm.ps1" "$kvmBinPath\kvm.ps1" + + Write-Host "Copying file $kvmBinPath\kvm.cmd" + copy "$scriptFolder\kvm.cmd" "$kvmBinPath\kvm.cmd" + + Write-Host "Adding $kvmBinPath to process PATH" + Set-Path (Change-Path $env:Path $kvmBinPath ($kvmBinPath)) + + Write-Host "Adding $kvmBinPath to user PATH" + $userPath = [Environment]::GetEnvironmentVariable("Path", [System.EnvironmentVariableTarget]::User) + $userPath = Change-Path $userPath $kvmBinPath ($kvmBinPath) + [Environment]::SetEnvironmentVariable("Path", $userPath, [System.EnvironmentVariableTarget]::User) + + Write-Host "Adding $globalKrePath;%USERPROFILE%\.kre to process KRE_HOME" + $envKreHome = $env:KRE_HOME + $envKreHome = Change-Path $envKreHome "%USERPROFILE%\.kre" ("%USERPROFILE%\.kre") + $envKreHome = Change-Path $envKreHome $globalKrePath ($globalKrePath) + $env:KRE_HOME = $envKreHome + + Write-Host "Adding $globalKrePath;%USERPROFILE%\.kre to machine KRE_HOME" + $machineKreHome = [Environment]::GetEnvironmentVariable("KRE_HOME", [System.EnvironmentVariableTarget]::Machine) + $machineKreHome = Change-Path $machineKreHome "%USERPROFILE%\.kre" ("%USERPROFILE%\.kre") + $machineKreHome = Change-Path $machineKreHome $globalKrePath ($globalKrePath) + [Environment]::SetEnvironmentVariable("KRE_HOME", $machineKreHome, [System.EnvironmentVariableTarget]::Machine) + +# $persistent = $false +# Kvm-Global-Upgrade +} + +function Kvm-Global-Upgrade { + $persistent = $true + If (Needs-Elevation) { + $arguments = "& '$scriptPath' upgrade -global $(Requested-Switches)" + Start-Process "$psHome\powershell.exe" -Verb runAs -ArgumentList $arguments -Wait + break + } + $version = Kvm-Find-Latest (Requested-Platform "svr50") (Requested-Architecture "x86") + Kvm-Global-Install $version + Kvm-Alias-Set "default" $version +} + +function Kvm-Upgrade { + $persistent = $true + $version = Kvm-Find-Latest (Requested-Platform "svr50") (Requested-Architecture "x86") + Kvm-Install $version + Kvm-Alias-Set "default" $version +} + +function Kvm-Find-Latest { +param( + [string] $platform, + [string] $architecture +) + Write-Host "Determining latest version" + + $url = "https://www.myget.org/F/aspnetvnext/api/v2/GetUpdates()?packageIds=%27KRE-$platform-$architecture%27&versions=%270.0%27&includePrerelease=true&includeAllVersions=false" + + $wc = New-Object System.Net.WebClient + $wc.Credentials = new-object System.Net.NetworkCredential("aspnetreadonly", "4d8a2d9c-7b80-4162-9978-47e918c9658c") + [xml]$xml = $wc.DownloadString($url) + + $version = Select-Xml "//d:Version" -Namespace @{d='http://schemas.microsoft.com/ado/2007/08/dataservices'} $xml + + return $version +} + +function Kvm-Install-Latest { + Kvm-Install (Kvm-Find-Latest (Requested-Platform "svr50") (Requested-Architecture "x86")) +} + +function Do-Kvm-Download { +param( + [string] $kreFullName, + [string] $kreFolder +) + $parts = $kreFullName.Split(".", 2) + + $url = "https://www.myget.org/F/aspnetvnext/api/v2/package/" + $parts[0] + "/" + $parts[1] + $kreFile = "$kreFolder\$kreFullName.nupkg" + + If (Test-Path $kreFolder) { + Remove-Item $kreFolder -Force -Recurse + } + + Write-Host "Downloading" $kreFullName "from https://www.myget.org/F/aspnetvnext/api/v2/" + + md $kreFolder -Force | Out-Null + + $wc = New-Object System.Net.WebClient + $wc.Credentials = new-object System.Net.NetworkCredential("aspnetreadonly", "4d8a2d9c-7b80-4162-9978-47e918c9658c") + $wc.DownloadFile($url, $kreFile) + + Do-Kvm-Unpack $kreFile $kreFolder +} + +function Do-Kvm-Unpack { +param( + [string] $kreFile, + [string] $kreFolder +) + Write-Host "Installing to" $kreFolder + + [System.Reflection.Assembly]::LoadWithPartialName('System.IO.Compression.FileSystem') | Out-Null + [System.IO.Compression.ZipFile]::ExtractToDirectory($kreFile, $kreFolder) + + If (Test-Path ($kreFolder + "\[Content_Types].xml")) { + Remove-Item ($kreFolder + "\[Content_Types].xml") + } + If (Test-Path ($kreFolder + "\_rels\")) { + Remove-Item ($kreFolder + "\_rels\") -Force -Recurse + } + If (Test-Path ($kreFolder + "\package\")) { + Remove-Item ($kreFolder + "\package\") -Force -Recurse + } +} + +function Kvm-Global-Install { +param( + [string] $versionOrAlias +) + If (Needs-Elevation) { + $arguments = "& '$scriptPath' install -global $versionOrAlias $(Requested-Switches)" + Start-Process "$psHome\powershell.exe" -Verb runAs -ArgumentList $arguments -Wait + Kvm-Global-Use $versionOrAlias + break + } + + $kreFullName = Requested-VersionOrAlias $versionOrAlias + $kreFolder = "$globalKrePackages\$kreFullName" + Do-Kvm-Download $kreFullName $kreFolder + Kvm-Use $versionOrAlias +} + +function Kvm-Install { +param( + [string] $versionOrAlias +) + if ($versionOrAlias.EndsWith(".nupkg")) + { + $kreFullName = [System.IO.Path]::GetFileNameWithoutExtension($versionOrAlias) + $kreFolder = "$userKrePackages\$kreFullName" + $kreFile = "$kreFolder\$kreFullName.nupkg" + + if (Test-Path($kreFolder)) { + Write-Host "Target folder '$kreFolder' already exists" + } else { + md $kreFolder -Force | Out-Null + copy $versionOrAlias $kreFile + Do-Kvm-Unpack $kreFile $kreFolder + } + + $kreBin = "$kreFolder\bin" + Write-Host "Adding" $kreBin "to process PATH" + Set-Path (Change-Path $env:Path $kreBin ($globalKrePackages, $userKrePackages)) + } + else + { + $kreFullName = Requested-VersionOrAlias $versionOrAlias + + $kreFolder = "$userKrePackages\$kreFullName" + + Do-Kvm-Download $kreFullName $kreFolder + Kvm-Use $versionOrAlias + } +} + +function Kvm-List { + $kreHome = $env:KRE_HOME + if (!$kreHome) { + $kreHome = $env:ProgramFiles + "\KRE;%USERPROFILE%\.kre" + } + $items = @() + foreach($portion in $kreHome.Split(';')) { + $path = [System.Environment]::ExpandEnvironmentVariables($portion) + if (Test-Path("$path\packages")) { + $items += Get-ChildItem ("$path\packages\KRE-*") | List-Parts + } + } + $items | Sort-Object Version, Runtime, Architecture | Format-Table -AutoSize -Property @{name="Active";expression={$_.Active};alignment="center"}, "Version", "Runtime", "Architecture", "Location" +} + +filter List-Parts { + $hasBin = Test-Path($_.FullName+"\bin") + if (!$hasBin) { + return + } + $active = $false + foreach($portion in $env:Path.Split(';')) { + if ($portion.StartsWith($_.FullName)) { + $active = $true + } + } + $parts1 = $_.Name.Split('.', 2) + $parts2 = $parts1[0].Split('-', 3) + return New-Object PSObject -Property @{ + Active = if($active){"*"}else{""} + Version = $parts1[1] + Runtime = $parts2[1] + Architecture = $parts2[2] + Location = $_.Parent.FullName + } +} + +function Kvm-Global-Use { +param( + [string] $versionOrAlias +) + If (Needs-Elevation) { + $arguments = "& '$scriptPath' use -global $versionOrAlias $(Requested-Switches)" + if ($persistent) { + $arguments = $arguments + " -persistent" + } + Start-Process "$psHome\powershell.exe" -Verb runAs -ArgumentList $arguments -Wait + break + } + + if ($versionOrAlias -eq "none") { + Write-Host "Removing KRE from process PATH" + Set-Path (Change-Path $env:Path "" ($globalKrePackages, $userKrePackages)) + + if ($persistent) { + Write-Host "Removing KRE from machine PATH" + $machinePath = [Environment]::GetEnvironmentVariable("Path", [System.EnvironmentVariableTarget]::Machine) + $machinePath = Change-Path $machinePath "" ($globalKrePackages, $userKrePackages) + [Environment]::SetEnvironmentVariable("Path", $machinePath, [System.EnvironmentVariableTarget]::Machine) + } + return; + } + + $kreFullName = Requested-VersionOrAlias $versionOrAlias + + $kreBin = Locate-KreBinFromFullName $kreFullName + if ($kreBin -eq $null) { + Write-Host "Cannot find $kreFullName, do you need to run 'kvm install $versionOrAlias'?" + return + } + + Write-Host "Adding" $kreBin "to process PATH" + Set-Path (Change-Path $env:Path $kreBin ($globalKrePackages, $userKrePackages)) + + if ($persistent) { + Write-Host "Adding $kreBin to machine PATH" + $machinePath = [Environment]::GetEnvironmentVariable("Path", [System.EnvironmentVariableTarget]::Machine) + $machinePath = Change-Path $machinePath $kreBin ($globalKrePackages, $userKrePackages) + [Environment]::SetEnvironmentVariable("Path", $machinePath, [System.EnvironmentVariableTarget]::Machine) + } +} + +function Kvm-Use { +param( + [string] $versionOrAlias +) + if ($versionOrAlias -eq "none") { + Write-Host "Removing KRE from process PATH" + Set-Path (Change-Path $env:Path "" ($globalKrePackages, $userKrePackages)) + + if ($persistent) { + Write-Host "Removing KRE from user PATH" + $userPath = [Environment]::GetEnvironmentVariable("Path", [System.EnvironmentVariableTarget]::User) + $userPath = Change-Path $userPath "" ($globalKrePackages, $userKrePackages) + [Environment]::SetEnvironmentVariable("Path", $userPath, [System.EnvironmentVariableTarget]::User) + } + return; + } + + $kreFullName = Requested-VersionOrAlias $versionOrAlias + + $kreBin = Locate-KreBinFromFullName $kreFullName + if ($kreBin -eq $null) { + Write-Host "Cannot find $kreFullName, do you need to run 'kvm install $versionOrAlias'?" + return + } + + Write-Host "Adding" $kreBin "to process PATH" + Set-Path (Change-Path $env:Path $kreBin ($globalKrePackages, $userKrePackages)) + + if ($persistent) { + Write-Host "Adding $kreBin to user PATH" + $userPath = [Environment]::GetEnvironmentVariable("Path", [System.EnvironmentVariableTarget]::User) + $userPath = Change-Path $userPath $kreBin ($globalKrePackages, $userKrePackages) + [Environment]::SetEnvironmentVariable("Path", $userPath, [System.EnvironmentVariableTarget]::User) + } +} + +function Kvm-Alias-List { + md ($userKrePath + "\alias\") -Force | Out-Null + + Get-ChildItem ($userKrePath + "\alias\") | Select @{label='Alias';expression={$_.BaseName}}, @{label='Name';expression={Get-Content $_.FullName }} | Format-Table -AutoSize +} + +function Kvm-Alias-Get { +param( + [string] $name +) + md ($userKrePath + "\alias\") -Force | Out-Null + Write-Host "Alias '$name' is set to" (Get-Content ($userKrePath + "\alias\" + $name + ".txt")) +} + +function Kvm-Alias-Set { +param( + [string] $name, + [string] $value +) + $kreFullName = "KRE-" + (Requested-Platform "svr50") + "-" + (Requested-Architecture "x86") + "." + $value + + Write-Host "Setting alias '$name' to '$kreFullName'" + md ($userKrePath + "\alias\") -Force | Out-Null + $kreFullName | Out-File ($userKrePath + "\alias\" + $name + ".txt") ascii +} + +function Locate-KreBinFromFullName() { +param( + [string] $kreFullName +) + $kreHome = $env:KRE_HOME + if (!$kreHome) { + $kreHome = $env:ProgramFiles + ";%USERPROFILE%\.kre" + } + foreach($portion in $kreHome.Split(';')) { + $path = [System.Environment]::ExpandEnvironmentVariables($portion) + $kreBin = "$path\packages\$kreFullName\bin" + if (Test-Path "$kreBin") { + return $kreBin + } + } + return $null +} + +function Requested-VersionOrAlias() { +param( + [string] $versionOrAlias +) + If (Test-Path ($userKrePath + "\alias\" + $versionOrAlias + ".txt")) { + $aliasValue = Get-Content ($userKrePath + "\alias\" + $versionOrAlias + ".txt") + $parts = $aliasValue.Split('.', 2) + $pkgVersion = $parts[1] + $parts =$parts[0].Split('-', 3) + $pkgPlatform = Requested-Platform $parts[1] + $pkgArchitecture = Requested-Architecture $parts[2] + } else { + $pkgVersion = $versionOrAlias + $pkgPlatform = Requested-Platform "svr50" + $pkgArchitecture = Requested-Architecture "x86" + } + return "KRE-" + $pkgPlatform + "-" + $pkgArchitecture + "." + $pkgVersion +} + +function Requested-Platform() { +param( + [string] $default +) + if ($svr50 -and $svrc50) { + Throw "This command cannot accept both -svr50 and -svrc50" + } + if ($svr50) { + return "svr50" + } + if ($svrc50) { + return "svrc50" + } + return $default +} + +function Requested-Architecture() { +param( + [string] $default +) + if ($x86 -and $x64) { + Throw "This command cannot accept both -x86 and -x64" + } + if ($x86) { + return "x86" + } + if ($x64) { + return "x64" + } + return $default +} + +function Change-Path() { +param( + [string] $existingPaths, + [string] $prependPath, + [string[]] $removePaths +) + $newPath = $prependPath + foreach($portion in $existingPaths.Split(';')) { + $skip = $portion -eq "" + foreach($removePath in $removePaths) { + if ($portion.StartsWith($removePath)) { + $skip = $true + } + } + if (!$skip) { + $newPath = $newPath + ";" + $portion + } + } + return $newPath +} + +function Set-Path() { +param( + [string] $newPath +) + md $userKrePath -Force | Out-Null + $env:Path = $newPath +@" +SET "PATH=$newPath" +"@ | Out-File ($userKrePath + "\run-once.cmd") ascii +} + +function Needs-Elevation() { + $user = [Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent() + $elevated = $user.IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator") + return -NOT $elevated +} + +function Requested-Switches() { + $arguments = "" + if ($x86) {$arguments = "$arguments -x86"} + if ($x64) {$arguments = "$arguments -x64"} + if ($svr50) {$arguments = "$arguments -svr50"} + if ($svrc50) {$arguments = "$arguments -svrc50"} + return $arguments +} + + try { + if ($global) { + switch -wildcard ($command + " " + $args.Count) { + "setup 0" {Kvm-Global-Setup} + "upgrade 0" {Kvm-Global-Upgrade} +# "install 0" {Kvm-Global-Install-Latest} + "install 1" {Kvm-Global-Install $args[0]} +# "list 0" {Kvm-Global-List} + "use 1" {Kvm-Global-Use $args[0]} + default {Write-Host 'Unknown command, or global switch not supported'; Kvm-Help;} + } + } else { + switch -wildcard ($command + " " + $args.Count) { + "setup 0" {Kvm-Global-Setup} + "upgrade 0" {Kvm-Upgrade} +# "install 0" {Kvm-Install-Latest} + "install 1" {Kvm-Install $args[0]} + "list 0" {Kvm-List} + "use 1" {Kvm-Use $args[0]} + "alias 0" {Kvm-Alias-List} + "alias 1" {Kvm-Alias-Get $args[0]} + "alias 2" {Kvm-Alias-Set $args[0] $args[1]} + "help 0" {Kvm-Help} + " 0" {Kvm-Help} + default {Write-Host 'Unknown command'; Kvm-Help;} + } + } + } + catch { + Write-Host $_ -ForegroundColor Red ; + } diff --git a/kvmsetup.cmd b/kvmsetup.cmd new file mode 100644 index 000000000000..051c1c606e1b --- /dev/null +++ b/kvmsetup.cmd @@ -0,0 +1 @@ +@"%~dp0kvm.cmd" setup diff --git a/samples/ConsoleApp/project.json b/samples/ConsoleApp/project.json index 488a2654c816..7cfcc032b8a6 100644 --- a/samples/ConsoleApp/project.json +++ b/samples/ConsoleApp/project.json @@ -1,13 +1,9 @@ { - "dependencies" : { - }, - "configurations": { - "net45" : {}, - "k10": { - "dependencies": { - "System.Runtime": "4.0.20.0", - "System.Console": "4.0.0.0" - } - } - } - } \ No newline at end of file + "dependencies": { + "System.Console": "4.0.0.0" + }, + "configurations": { + "net45": {}, + "k10": {} + } +} \ No newline at end of file diff --git a/samples/ConsoleApp/project.json.140508133553.bak b/samples/ConsoleApp/project.json.140508133553.bak new file mode 100644 index 000000000000..9673200c479f --- /dev/null +++ b/samples/ConsoleApp/project.json.140508133553.bak @@ -0,0 +1,9 @@ +{ + "dependencies" : { + "System.Console": "4.0.0.0" + }, + "configurations": { + "net45" : {}, + "k10": {} + } + } \ No newline at end of file diff --git a/samples/HelloWeb/Startup.cs b/samples/HelloWeb/Startup.cs index 5de855d83bb6..bab8f92d0ea3 100644 --- a/samples/HelloWeb/Startup.cs +++ b/samples/HelloWeb/Startup.cs @@ -1,5 +1,4 @@ -using Microsoft.AspNet.Abstractions; -using Microsoft.AspNet; +using Microsoft.AspNet.Builder; namespace KWebStartup { diff --git a/samples/HelloWeb/project.json b/samples/HelloWeb/project.json index 25debbf27083..7d02f15fab13 100644 --- a/samples/HelloWeb/project.json +++ b/samples/HelloWeb/project.json @@ -1,35 +1,16 @@ -{ - "version": "0.1-alpha-*", - "dependencies": { - "Microsoft.AspNet.Abstractions": "0.1-alpha-279", - "Microsoft.AspNet.Hosting": "0.1-alpha-300", - "Microsoft.AspNet.Server.WebListener": "0.1-alpha-245", - "Microsoft.AspNet.Diagnostics": "0.1-alpha-192", - "Microsoft.AspNet.StaticFiles": "0.1-alpha-223" - }, - "commands": { "web": "Microsoft.AspNet.Hosting server.name=Microsoft.AspNet.Server.WebListener server.urls=http://localhost:5001" }, - "configurations": { - "net45": { - }, - "k10": { - "dependencies": { - "System.Console": "4.0.0.0", - "System.Collections": "4.0.0.0", - "System.Diagnostics.Debug": "4.0.10.0", - "System.Diagnostics.Tools": "4.0.0.0", - "System.Globalization": "4.0.10.0", - "System.IO": "4.0.0.0", - "System.IO.FileSystem": "4.0.0.0", - "System.IO.FileSystem.Primitives": "4.0.0.0", - "System.Linq": "4.0.0.0", - "System.Reflection": "4.0.10.0", - "System.Resources.ResourceManager": "4.0.0.0", - "System.Runtime": "4.0.20.0", - "System.Runtime.Extensions": "4.0.10.0", - "System.Runtime.InteropServices": "4.0.10.0", - "System.Text.Encoding": "4.0.10.0", - "System.Threading.Tasks": "4.0.0.0" - } - } - } +{ + "version": "0.1-alpha-*", + "dependencies": { + "Microsoft.AspNet.Hosting": "0.1-alpha-build-0489", + "Microsoft.AspNet.Server.WebListener": "0.1-alpha-build-0437", + "Microsoft.AspNet.Diagnostics": "0.1-alpha-build-0559", + "Microsoft.AspNet.StaticFiles": "0.1-alpha-build-0378" + }, + "commands": { + "web": "Microsoft.AspNet.Hosting server.name=Microsoft.AspNet.Server.WebListener server.urls=http://localhost:5001" + }, + "configurations": { + "net45": {}, + "k10": {} + } } \ No newline at end of file diff --git a/samples/HelloWeb/project.json.140508133915.bak b/samples/HelloWeb/project.json.140508133915.bak new file mode 100644 index 000000000000..bb65e51812e6 --- /dev/null +++ b/samples/HelloWeb/project.json.140508133915.bak @@ -0,0 +1,16 @@ +{ + "version": "0.1-alpha-*", + "dependencies": { + "Microsoft.AspNet.Hosting": "0.1-alpha-*", + "Microsoft.AspNet.Server.WebListener": "0.1-alpha-*", + "Microsoft.AspNet.Diagnostics": "0.1-alpha-*", + "Microsoft.AspNet.StaticFiles": "0.1-alpha-*" + }, + "commands": { "web": "Microsoft.AspNet.Hosting server.name=Microsoft.AspNet.Server.WebListener server.urls=http://localhost:5001" }, + "configurations": { + "net45": { + }, + "k10": { + } + } +} \ No newline at end of file diff --git a/samples/HelloWebFx/Startup.cs b/samples/HelloWebFx/Startup.cs index eda27a4e9bdd..16dd4db64282 100644 --- a/samples/HelloWebFx/Startup.cs +++ b/samples/HelloWebFx/Startup.cs @@ -1,8 +1,6 @@ -using Microsoft.AspNet; -using Microsoft.AspNet.Abstractions; -using Microsoft.AspNet.Mvc; using Microsoft.AspNet.Routing; -using Microsoft.AspNet.Diagnostics; +using Microsoft.AspNet.Builder; +using Microsoft.Framework.DependencyInjection; namespace KWebStartup { @@ -19,7 +17,7 @@ public void Configuration(IBuilder app) app.UseMvc(routes => { - routes.MapRoute("{controller}/{action}", new { controller = "Home", action = "Index" }); + routes.MapRoute(null, "{controller}/{action}", new { controller = "Home", action = "Index" }); }); app.UseWelcomePage(); diff --git a/samples/HelloWebFx/project.json b/samples/HelloWebFx/project.json index cd66af84d011..ab3903a86191 100644 --- a/samples/HelloWebFx/project.json +++ b/samples/HelloWebFx/project.json @@ -1,48 +1,21 @@ -{ - "version": "0.1-alpha-*", - "dependencies": { - "Microsoft.AspNet.Abstractions": "0.1-alpha-279", - "Microsoft.AspNet.Hosting": "0.1-alpha-300", - "Microsoft.AspNet.Server.WebListener": "0.1-alpha-245", - "Microsoft.AspNet.DependencyInjection": "0.1-alpha-267", - "Microsoft.AspNet.RequestContainer": "0.1-alpha-300", - "Microsoft.AspNet.Routing": "0.1-alpha-281", - "Microsoft.ComponentModel.DataAnnotations": "4.0.10.0", - "Microsoft.AspNet.Mvc.ModelBinding": "0.1-alpha-699", - "Microsoft.AspNet.Mvc.Core": "0.1-alpha-699", - "Microsoft.AspNet.Mvc": "0.1-alpha-699", - "Microsoft.AspNet.Mvc.Razor": "0.1-alpha-699", - "Microsoft.AspNet.ConfigurationModel": "0.1-alpha-180", - "Microsoft.AspNet.Diagnostics": "0.1-alpha-192" - }, - "commands": { "web": "Microsoft.AspNet.Hosting server.name=Microsoft.AspNet.Server.WebListener server.urls=http://localhost:5001" }, - "configurations": { - "net45": { - "dependencies": { - "System.ComponentModel.DataAnnotations": "" - } - }, - "k10": { - "dependencies": { - "System.Console": "4.0.0.0", - "System.Collections": "4.0.0.0", - "System.Diagnostics.Debug": "4.0.10.0", - "System.Diagnostics.Tools": "4.0.0.0", - "System.Globalization": "4.0.10.0", - "System.IO": "4.0.0.0", - "System.IO.FileSystem": "4.0.0.0", - "System.IO.FileSystem.Primitives": "4.0.0.0", - "System.Linq": "4.0.0.0", - "System.Reflection": "4.0.10.0", - "System.Resources.ResourceManager": "4.0.0.0", - "System.Runtime": "4.0.20.0", - "System.Runtime.Extensions": "4.0.10.0", - "System.Runtime.InteropServices": "4.0.10.0", - "System.Text.Encoding": "4.0.10.0", - "System.Threading.Tasks": "4.0.10.0", - "System.ComponentModel": "4.0.0.0", - "System.Dynamic.Runtime": "4.0.0.0" - } - } - } +{ + "version": "0.1-alpha-*", + "dependencies": { + "Microsoft.AspNet.Hosting": "0.1-alpha-build-0489", + "Microsoft.AspNet.Server.WebListener": "0.1-alpha-build-0437", + "Microsoft.AspNet.Mvc": "0.1-alpha-*", + "Microsoft.AspNet.Diagnostics": "0.1-alpha-build-0559" + }, + "commands": { + "web": "Microsoft.AspNet.Hosting server.name=Microsoft.AspNet.Server.WebListener server.urls=http://localhost:5001" + }, + "configurations": { + "net45": { + "dependencies": { + "System.Runtime": "", + "System.ComponentModel.DataAnnotations": "" + } + }, + "k10": {} + } } \ No newline at end of file diff --git a/samples/HelloWebFx/project.json.140508133950.bak b/samples/HelloWebFx/project.json.140508133950.bak new file mode 100644 index 000000000000..dfd154a136a7 --- /dev/null +++ b/samples/HelloWebFx/project.json.140508133950.bak @@ -0,0 +1,19 @@ +{ + "version": "0.1-alpha-*", + "dependencies": { + "Microsoft.AspNet.Hosting": "0.1-alpha-*", + "Microsoft.AspNet.Server.WebListener": "0.1-alpha-*", + "Microsoft.AspNet.Mvc": "0.1-alpha-*", + "Microsoft.AspNet.Diagnostics": "0.1-alpha-*" + }, + "commands": { "web": "Microsoft.AspNet.Hosting server.name=Microsoft.AspNet.Server.WebListener server.urls=http://localhost:5001" }, + "configurations": { + "net45": { + "dependencies": { + "System.Runtime":"", + "System.ComponentModel.DataAnnotations": "" + } + }, + "k10": {} + } +} \ No newline at end of file From c1b2ee49588c854db6b5dc5d7d0e161e0257c235 Mon Sep 17 00:00:00 2001 From: Glenn Condron Date: Fri, 9 May 2014 11:51:43 -0700 Subject: [PATCH 2/5] Change Configuration to Configure and update package numbers --- samples/HelloWeb/Startup.cs | 2 +- samples/HelloWeb/project.json | 12 ++++++------ samples/HelloWebFx/Startup.cs | 2 +- samples/HelloWebFx/project.json | 10 +++++----- 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/samples/HelloWeb/Startup.cs b/samples/HelloWeb/Startup.cs index bab8f92d0ea3..96e399e2efa5 100644 --- a/samples/HelloWeb/Startup.cs +++ b/samples/HelloWeb/Startup.cs @@ -4,7 +4,7 @@ namespace KWebStartup { public class Startup { - public void Configuration(IBuilder app) + public void Configure(IBuilder app) { app.UseStaticFiles(); app.UseWelcomePage(); diff --git a/samples/HelloWeb/project.json b/samples/HelloWeb/project.json index 7d02f15fab13..eba5efac21ab 100644 --- a/samples/HelloWeb/project.json +++ b/samples/HelloWeb/project.json @@ -1,13 +1,13 @@ { "version": "0.1-alpha-*", "dependencies": { - "Microsoft.AspNet.Hosting": "0.1-alpha-build-0489", - "Microsoft.AspNet.Server.WebListener": "0.1-alpha-build-0437", - "Microsoft.AspNet.Diagnostics": "0.1-alpha-build-0559", - "Microsoft.AspNet.StaticFiles": "0.1-alpha-build-0378" + "Microsoft.AspNet.Diagnostics": "0.1-alpha-build-0591", + "Microsoft.AspNet.Hosting": "0.1-alpha-build-0502", + "Microsoft.AspNet.Server.WebListener": "0.1-alpha-build-0452", + "Microsoft.AspNet.StaticFiles": "0.1-alpha-build-0388" }, - "commands": { - "web": "Microsoft.AspNet.Hosting server.name=Microsoft.AspNet.Server.WebListener server.urls=http://localhost:5001" + "commands": { + "web": "Microsoft.AspNet.Hosting server=Microsoft.AspNet.Server.WebListener server.urls=http://localhost:5001" }, "configurations": { "net45": {}, diff --git a/samples/HelloWebFx/Startup.cs b/samples/HelloWebFx/Startup.cs index 16dd4db64282..2ffd59f6bb32 100644 --- a/samples/HelloWebFx/Startup.cs +++ b/samples/HelloWebFx/Startup.cs @@ -6,7 +6,7 @@ namespace KWebStartup { public class Startup { - public void Configuration(IBuilder app) + public void Configure(IBuilder app) { app.UseErrorPage(); diff --git a/samples/HelloWebFx/project.json b/samples/HelloWebFx/project.json index ab3903a86191..965ca74bd0fd 100644 --- a/samples/HelloWebFx/project.json +++ b/samples/HelloWebFx/project.json @@ -1,13 +1,13 @@ { "version": "0.1-alpha-*", "dependencies": { - "Microsoft.AspNet.Hosting": "0.1-alpha-build-0489", - "Microsoft.AspNet.Server.WebListener": "0.1-alpha-build-0437", - "Microsoft.AspNet.Mvc": "0.1-alpha-*", - "Microsoft.AspNet.Diagnostics": "0.1-alpha-build-0559" + "Microsoft.AspNet.Diagnostics": "0.1-alpha-build-0591", + "Microsoft.AspNet.Hosting": "0.1-alpha-build-0502", + "Microsoft.AspNet.Mvc": "0.1-alpha-build-1095", + "Microsoft.AspNet.Server.WebListener": "0.1-alpha-build-0452" }, "commands": { - "web": "Microsoft.AspNet.Hosting server.name=Microsoft.AspNet.Server.WebListener server.urls=http://localhost:5001" + "web": "Microsoft.AspNet.Hosting server=Microsoft.AspNet.Server.WebListener server.urls=http://localhost:5001" }, "configurations": { "net45": { From f66543799294be28f94ace85fe83b3cfd8f9ca69 Mon Sep 17 00:00:00 2001 From: Glenn Condron Date: Mon, 12 May 2014 12:10:34 -0700 Subject: [PATCH 3/5] update readme, update kvm --- README.md | 24 +++++++++++++----------- kvm.ps1 | 10 +++++----- kvmsetup.cmd | 1 + 3 files changed, 19 insertions(+), 16 deletions(-) diff --git a/README.md b/README.md index bf19b9636a96..c91faba03c47 100644 --- a/README.md +++ b/README.md @@ -2,17 +2,19 @@ In the next version of ASP.NET we are working with multiple teams around Microsoft to create a lean, composable .NET stack that provides a familiar and modern framework for web and cloud scenarios. -The Preview repository is a place for the ASP.NET Insiders to log issues and discuss ASP.NET vNext with the product team. It contains some samples and some documentation in the [wiki](https://github.com/aspnet/Home/wiki). +The Home repository is the starting point for people to learn about ASP.NET vNext, it contains samples and [documentation](https://github.com/aspnet/Home/wiki) to help folks get started and learn more about what we are doing. +The Home repository is the starting point for people to learn about ASP.NET vNext, it contains samples and [documentation](https://github.com/aspnet/Home/wiki) to help folks get started and learn more about what we are doing. -The samples provided are designed to show some of the features of the new framework as well as setting up a sandbox for you to try out new drops of functionality as they come out. The NuGet.config file in the repo points to a private MyGet feed that has all the packages being developed. The feed is updated every time a full build succeeds. +The samples provided are designed to show some of the features of the new framework as well as setting up a sandbox for you to try out some of the new features. The NuGet.config file in the repo points to a MyGet feed that has all the packages being developed. The feed is updated every time a full build succeeds. #Getting Started -The first thing we need to do is setup the tools required to build and run an application. +The first thing we need to do is setup the tools required to build and run an application. We will start out by getting the [K Version Manager (KVM)](https://github.com/aspnet/Home/wiki/version-manager) * Clone the repository -* On the command line execute ```kvm setup``` -* This command will download the latest version of the SDK and put it on your path so that you can run the rest of the commands in the readme. If you want to know more about what this is doing then you can read the [KVM page](https://github.com/aspnet/Home/wiki/version-manager) of the wiki. +* On the command line execute ```kvmsetup.cmd``` +* This command will setup your environment, getting it ready to install a version of the runtime. It adds kvm to your path and puts it in your user profile. +* Execute ```kvm upgrade```. This command will download the latest version of the SDK and put it on your user profile ready to use. You could also install a specific version here instead of getting the latest, see the [KVM page](https://github.com/aspnet/Home/wiki/version-manager) * Navigate to samples\HelloConsole * Run ```K run``` * You should see some compiler output and a message saying "Hello World" @@ -23,25 +25,25 @@ The first thing we need to do is setup the tools required to build and run an ap These samples, in this repo, are just basic starting points for you to experiment with features. Since there is no File->New Project we thought some simple samples to take the place of scaffolding would be convenient. -+ [ConsoleApp](https://github.com/aspnet/Home/tree/master/samples/ConsoleApp). This is just basic console app if you want to use it as a starting point. Use it the same as the console app from our earlier samples ++ [ConsoleApp](https://github.com/aspnet/Home/tree/master/samples/ConsoleApp). This is just basic console app if you want to use it as a starting point. + [HelloWeb](https://github.com/aspnet/Home/tree/master/samples/HelloWeb). This is a minimal startup class that shows welcome page and static file middleware. This is mostly for you to run through the steps in the readme and make sure you have everything setup and working correctly. + [HelloWebFx](https://github.com/aspnet/Home/tree/master/samples/HelloWebFx). This sample is a basic MVC app. It is not designed to show all the functionality of the new web stack, but to give you a starting point to play with features. -**NOTE: The samples are pinned to a specific version of the packages. If you want to try the latest builds then update the project.json and replace the number at the end of the version with a '\*', so '0.1-alpha-267' becomes '0.1-alpha-\*', and then run ```K restore``` to pull down the latest packages** +**NOTE: The samples are pinned to a specific version of the packages. If you want to try the latest builds then update the project.json and replace the last part of the version with a '\*', so '0.1-alpha-build-267' becomes '0.1-alpha-\*', and then run ```kpm restore``` to pull down the latest packages** ##Feature Samples The [Entropy repo](https://github.com/aspnet/Entropy) contains samples of specific features in isolation. Each directory contains just enough code to show an aspect of a feature. ##Application Samples -[MVC Music Store](https://github.com/aspnet/MusicStore) and [BugTracker](https://github.com/aspnet/BugTracker) application are both being ported. Each of these have their own repository that you can look at. Both of these should be mostly working, but some changes are still being made. +[MVC Music Store](https://github.com/aspnet/MusicStore) and [BugTracker](https://github.com/aspnet/BugTracker) application are both being ported. Each of these have their own repository that you can look at. #Running the samples ##Running HelloWeb 1. Clone the repository -2. Change directory to Preview\Samples\HelloWeb -3. Run ```K restore``` +2. Change directory to Samples\HelloWeb +3. Run ```kpm restore``` 4. You should see a bunch of output as all the dependencies of the app are downloaded from MyGet. The K commands all operate on the app that is in the current directory. 5. Run ```K web``` 6. You should see build output and a message to show the site is now started @@ -50,7 +52,7 @@ The [Entropy repo](https://github.com/aspnet/Entropy) contains samples of specif 9. Navigate to "http://localhost:5001/image.jpg" 10. You should see an image served with the static file middleware -If you can do all of the above then everything should be working. You can try out the WebFx sample now to see some more of the new stack. You should run ```K restore``` before using any sample for the first time. +If you can do all of the above then everything should be working. You can try out the WebFx sample now to see some more of the new stack. You should run ```kpm restore``` before using any sample for the first time. #Switching to Core CLR diff --git a/kvm.ps1 b/kvm.ps1 index 822bddc22278..dc3d21cdd42a 100644 --- a/kvm.ps1 +++ b/kvm.ps1 @@ -63,8 +63,7 @@ function Kvm-Global-Setup { $arguments = "& '$scriptPath' setup $(Requested-Switches) -persistent" Start-Process "$psHome\powershell.exe" -Verb runAs -ArgumentList $arguments -Wait Write-Host "Setup complete" - Kvm-Alias-List - Kvm-List + Kvm-Help break } @@ -99,8 +98,8 @@ function Kvm-Global-Setup { $machineKreHome = Change-Path $machineKreHome $globalKrePath ($globalKrePath) [Environment]::SetEnvironmentVariable("KRE_HOME", $machineKreHome, [System.EnvironmentVariableTarget]::Machine) -# $persistent = $false -# Kvm-Global-Upgrade + Write-Host "Press any key to continue ..." + $x = $host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown,AllowCtrlC") } function Kvm-Global-Upgrade { @@ -155,7 +154,8 @@ param( $kreFile = "$kreFolder\$kreFullName.nupkg" If (Test-Path $kreFolder) { - Remove-Item $kreFolder -Force -Recurse + Write-Host "$kreFullName already installed." + return; } Write-Host "Downloading" $kreFullName "from https://www.myget.org/F/aspnetvnext/api/v2/" diff --git a/kvmsetup.cmd b/kvmsetup.cmd index 051c1c606e1b..d91eb940fe10 100644 --- a/kvmsetup.cmd +++ b/kvmsetup.cmd @@ -1 +1,2 @@ @"%~dp0kvm.cmd" setup +pause From e69304ecec66ec4eeeb85b0e66144da8ca4c956f Mon Sep 17 00:00:00 2001 From: Glenn Condron Date: Mon, 12 May 2014 12:21:06 -0700 Subject: [PATCH 4/5] remove project.json.bak files. Update startup to use default routes --- .../ConsoleApp/project.json.140508133553.bak | 9 --------- .../HelloWeb/project.json.140508133915.bak | 16 ---------------- samples/HelloWebFx/Startup.cs | 5 +---- .../HelloWebFx/project.json.140508133950.bak | 19 ------------------- 4 files changed, 1 insertion(+), 48 deletions(-) delete mode 100644 samples/ConsoleApp/project.json.140508133553.bak delete mode 100644 samples/HelloWeb/project.json.140508133915.bak delete mode 100644 samples/HelloWebFx/project.json.140508133950.bak diff --git a/samples/ConsoleApp/project.json.140508133553.bak b/samples/ConsoleApp/project.json.140508133553.bak deleted file mode 100644 index 9673200c479f..000000000000 --- a/samples/ConsoleApp/project.json.140508133553.bak +++ /dev/null @@ -1,9 +0,0 @@ -{ - "dependencies" : { - "System.Console": "4.0.0.0" - }, - "configurations": { - "net45" : {}, - "k10": {} - } - } \ No newline at end of file diff --git a/samples/HelloWeb/project.json.140508133915.bak b/samples/HelloWeb/project.json.140508133915.bak deleted file mode 100644 index bb65e51812e6..000000000000 --- a/samples/HelloWeb/project.json.140508133915.bak +++ /dev/null @@ -1,16 +0,0 @@ -{ - "version": "0.1-alpha-*", - "dependencies": { - "Microsoft.AspNet.Hosting": "0.1-alpha-*", - "Microsoft.AspNet.Server.WebListener": "0.1-alpha-*", - "Microsoft.AspNet.Diagnostics": "0.1-alpha-*", - "Microsoft.AspNet.StaticFiles": "0.1-alpha-*" - }, - "commands": { "web": "Microsoft.AspNet.Hosting server.name=Microsoft.AspNet.Server.WebListener server.urls=http://localhost:5001" }, - "configurations": { - "net45": { - }, - "k10": { - } - } -} \ No newline at end of file diff --git a/samples/HelloWebFx/Startup.cs b/samples/HelloWebFx/Startup.cs index 2ffd59f6bb32..48c8095a068d 100644 --- a/samples/HelloWebFx/Startup.cs +++ b/samples/HelloWebFx/Startup.cs @@ -15,10 +15,7 @@ public void Configure(IBuilder app) services.AddMvc(); }); - app.UseMvc(routes => - { - routes.MapRoute(null, "{controller}/{action}", new { controller = "Home", action = "Index" }); - }); + app.UseMvc(); app.UseWelcomePage(); } diff --git a/samples/HelloWebFx/project.json.140508133950.bak b/samples/HelloWebFx/project.json.140508133950.bak deleted file mode 100644 index dfd154a136a7..000000000000 --- a/samples/HelloWebFx/project.json.140508133950.bak +++ /dev/null @@ -1,19 +0,0 @@ -{ - "version": "0.1-alpha-*", - "dependencies": { - "Microsoft.AspNet.Hosting": "0.1-alpha-*", - "Microsoft.AspNet.Server.WebListener": "0.1-alpha-*", - "Microsoft.AspNet.Mvc": "0.1-alpha-*", - "Microsoft.AspNet.Diagnostics": "0.1-alpha-*" - }, - "commands": { "web": "Microsoft.AspNet.Hosting server.name=Microsoft.AspNet.Server.WebListener server.urls=http://localhost:5001" }, - "configurations": { - "net45": { - "dependencies": { - "System.Runtime":"", - "System.ComponentModel.DataAnnotations": "" - } - }, - "k10": {} - } -} \ No newline at end of file From 1167b7e01df60e38fe264f5748eaed1b88504245 Mon Sep 17 00:00:00 2001 From: Glenn Condron Date: Mon, 12 May 2014 12:27:35 -0700 Subject: [PATCH 5/5] Added space to web command --- samples/HelloWeb/project.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/samples/HelloWeb/project.json b/samples/HelloWeb/project.json index eba5efac21ab..ac963402479a 100644 --- a/samples/HelloWeb/project.json +++ b/samples/HelloWeb/project.json @@ -6,7 +6,7 @@ "Microsoft.AspNet.Server.WebListener": "0.1-alpha-build-0452", "Microsoft.AspNet.StaticFiles": "0.1-alpha-build-0388" }, - "commands": { + "commands": { "web": "Microsoft.AspNet.Hosting server=Microsoft.AspNet.Server.WebListener server.urls=http://localhost:5001" }, "configurations": {