Update KVM to newer build, update Readme to show how to use KVMInstall. Pipe md to out-null when creating temp directory.
This commit is contained in:
parent
c14ecd8e7a
commit
611469e3a9
12
README.md
12
README.md
|
|
@ -16,8 +16,6 @@ These are the current minimum requirements, they do not necesarilly represent ou
|
|||
### Windows
|
||||
* Windows 7 or greater, though Core CLR will only work on Windows 8 today. If using Core CLR you will need to be on Windows 8 or above. At RTM the whole stack will support Windows 7+ and Windows Server 2008 R2+.
|
||||
* .NET 4.5.1 for hosting in IIS
|
||||
* Powershell 4. KVM is a Powershell script that makes use of types that older verisons of Powershell cannot load
|
||||
|
||||
|
||||
### OSX/Linux
|
||||
* Mono >= 3.4.1 - Currently this means compiling Mono from source from https://github.com/mono/mono
|
||||
|
|
@ -28,11 +26,17 @@ These are the current minimum requirements, they do not necesarilly represent ou
|
|||
|
||||
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)
|
||||
|
||||
The easiest way to get the KVM on Windows is to run the following command:
|
||||
```powershell
|
||||
@powershell -NoProfile -ExecutionPolicy unrestricted -Command "iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/aspnet/Home/master/kvminstall.ps1'))"
|
||||
```
|
||||
This downloads KVM from this repository and puts it on your machine. Alternatively, you you could clone the repo and get it:
|
||||
* Clone the repository
|
||||
* On the command line execute
|
||||
* ```kvmsetup.cmd``` on Windows or
|
||||
* ```kvm setup``` on Windows or
|
||||
* ```sh kvmsetup.sh && source ~/.kre/kvm/kvm.sh``` on OSX/Linux
|
||||
* 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.
|
||||
|
||||
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. Once you have KVM then you need to get a version of the runtime:
|
||||
* Execute ```kvm install 0.1-alpha-build-0446```. This command will download the named version of the KRE and put it on your user profile ready to use. You can get the latest version by running ```kvm upgrade``` but 0446 was the last version explicitly tested. see the [KVM page](https://github.com/aspnet/Home/wiki/version-manager) for more information on KVM.
|
||||
* Navigate to samples\ConsoleApp
|
||||
* Run ```kpm restore```. This downloads the System.Console package so the app can do Console.WriteLine
|
||||
|
|
|
|||
94
kvm.ps1
94
kvm.ps1
|
|
@ -4,6 +4,7 @@ param(
|
|||
[switch] $verbosity = $false,
|
||||
[alias("g")][switch] $global = $false,
|
||||
[alias("p")][switch] $persistent = $false,
|
||||
[alias("f")][switch] $force = $false,
|
||||
[switch] $x86 = $false,
|
||||
[switch] $x64 = $false,
|
||||
[switch] $svr50 = $false,
|
||||
|
|
@ -21,20 +22,22 @@ $scriptPath = $myInvocation.MyCommand.Definition
|
|||
|
||||
function Kvm-Help {
|
||||
@"
|
||||
K Runtime Environment Version Manager - Build 482
|
||||
K Runtime Environment Version Manager - Build 509
|
||||
|
||||
USAGE: kvm <command> [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
|
||||
add KRE bin to user PATH environment variable
|
||||
-g|-global install to machine-wide location
|
||||
-f|-force upgrade even if latest is already installed
|
||||
|
||||
kvm install <semver>|<alias>|<nupkg> [-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
|
||||
-f|-force install even if specified version is already installed
|
||||
|
||||
kvm use <semver>|<alias>|none [-x86][-x64] [-svr50][-svrc50] [-p|-persistent] [-g|-global]
|
||||
<semver>|<alias> add KRE bin to path of current command line
|
||||
|
|
@ -146,27 +149,45 @@ function Kvm-Install-Latest {
|
|||
function Do-Kvm-Download {
|
||||
param(
|
||||
[string] $kreFullName,
|
||||
[string] $kreFolder
|
||||
[string] $packagesFolder
|
||||
)
|
||||
$parts = $kreFullName.Split(".", 2)
|
||||
|
||||
$url = "https://www.myget.org/F/aspnetvnext/api/v2/package/" + $parts[0] + "/" + $parts[1]
|
||||
$kreFile = "$kreFolder\$kreFullName.nupkg"
|
||||
$kreFolder = Join-Path $packagesFolder $kreFullName
|
||||
$kreFile = Join-Path $kreFolder "$kreFullName.nupkg"
|
||||
|
||||
If (Test-Path $kreFolder) {
|
||||
Write-Host "$kreFullName already installed."
|
||||
return;
|
||||
if($force)
|
||||
{
|
||||
rm $kreFolder -Recurse -Force
|
||||
} else {
|
||||
Write-Host "$kreFullName already installed."
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
Write-Host "Downloading" $kreFullName "from https://www.myget.org/F/aspnetvnext/api/v2/"
|
||||
|
||||
md $kreFolder -Force | Out-Null
|
||||
#Downloading to temp location
|
||||
$kreTempDownload = Join-Path $packagesFolder "temp"
|
||||
$tempKreFile = Join-Path $kreTempDownload "$kreFullName.nupkg"
|
||||
|
||||
if(Test-Path $kreTempDownload) {
|
||||
del "$kreTempDownload\*" -recurse
|
||||
} else {
|
||||
md $kreTempDownload -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)
|
||||
$wc.DownloadFile($url, $tempKreFile)
|
||||
|
||||
Do-Kvm-Unpack $kreFile $kreFolder
|
||||
Do-Kvm-Unpack $tempKreFile $kreTempDownload
|
||||
|
||||
md $kreFolder -Force | Out-Null
|
||||
Write-Host "Installing to $kreFolder"
|
||||
mv "$kreTempDownload\*" $kreFolder
|
||||
}
|
||||
|
||||
function Do-Kvm-Unpack {
|
||||
|
|
@ -174,10 +195,21 @@ 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)
|
||||
Write-Host "Unpacking to" $kreFolder
|
||||
try {
|
||||
#Shell will not recognize nupkg as a zip and throw, so rename it to zip
|
||||
$kreZip = [System.IO.Path]::ChangeExtension($kreFile, "zip")
|
||||
Rename-Item $kreFile $kreZip
|
||||
#Use the shell to uncompress the nupkg
|
||||
$shell_app=new-object -com shell.application
|
||||
$zip_file = $shell_app.namespace($kreZip)
|
||||
$destination = $shell_app.namespace($kreFolder)
|
||||
$destination.Copyhere($zip_file.items(), 0x14) #0x4 = don't show UI, 0x10 = overwrite files
|
||||
}
|
||||
finally {
|
||||
#make it a nupkg again
|
||||
Rename-Item $kreZip $kreFile
|
||||
}
|
||||
|
||||
If (Test-Path ($kreFolder + "\[Content_Types].xml")) {
|
||||
Remove-Item ($kreFolder + "\[Content_Types].xml")
|
||||
|
|
@ -202,8 +234,8 @@ param(
|
|||
}
|
||||
|
||||
$kreFullName = Requested-VersionOrAlias $versionOrAlias
|
||||
$kreFolder = "$globalKrePackages\$kreFullName"
|
||||
Do-Kvm-Download $kreFullName $kreFolder
|
||||
|
||||
Do-Kvm-Download $kreFullName $globalKrePackages
|
||||
Kvm-Use $versionOrAlias
|
||||
}
|
||||
|
||||
|
|
@ -215,14 +247,30 @@ param(
|
|||
{
|
||||
$kreFullName = [System.IO.Path]::GetFileNameWithoutExtension($versionOrAlias)
|
||||
$kreFolder = "$userKrePackages\$kreFullName"
|
||||
$kreFile = "$kreFolder\$kreFullName.nupkg"
|
||||
$folderExists = Test-Path $kreFolder
|
||||
|
||||
if (Test-Path($kreFolder)) {
|
||||
Write-Host "Target folder '$kreFolder' already exists"
|
||||
if($folderExists -and $force) {
|
||||
del $kreFolder -Recurse -Force
|
||||
$folderExists = $false;
|
||||
}
|
||||
|
||||
if($folderExists) {
|
||||
Write-Host "Target folder '$kreFolder' already exists"
|
||||
} else {
|
||||
md $kreFolder -Force | Out-Null
|
||||
copy $versionOrAlias $kreFile
|
||||
Do-Kvm-Unpack $kreFile $kreFolder
|
||||
$tempUnpackFolder = Join-Path $userKrePackages "temp"
|
||||
$tempKreFile = Join-Path $tempUnpackFolder "$kreFullName.nupkg"
|
||||
|
||||
if(Test-Path $tempUnpackFolder) {
|
||||
del "$tempUnpackFolder\*" -recurse
|
||||
} else {
|
||||
md $tempUnpackFolder -Force | Out-Null
|
||||
}
|
||||
copy $versionOrAlias $tempKreFile
|
||||
|
||||
Do-Kvm-Unpack $tempKreFile $tempUnpackFolder
|
||||
md $kreFolder -Force | Out-Null
|
||||
Write-Host "Installing to $kreFolder"
|
||||
mv "$tempUnpackFolder\*" $kreFolder
|
||||
}
|
||||
|
||||
$kreBin = "$kreFolder\bin"
|
||||
|
|
@ -233,9 +281,7 @@ param(
|
|||
{
|
||||
$kreFullName = Requested-VersionOrAlias $versionOrAlias
|
||||
|
||||
$kreFolder = "$userKrePackages\$kreFullName"
|
||||
|
||||
Do-Kvm-Download $kreFullName $kreFolder
|
||||
Do-Kvm-Download $kreFullName $userKrePackages
|
||||
Kvm-Use $versionOrAlias
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ $kvmPs1Path = Join-Path $tempPath "kvm.ps1"
|
|||
$kvmCmdPath = Join-Path $tempPath "kvm.cmd"
|
||||
|
||||
Write-Host "Using temporary directory: $tempPath"
|
||||
if (!(Test-Path $tempPath)) { md $tempPath }
|
||||
if (!(Test-Path $tempPath)) { md $tempPath | Out-Null }
|
||||
|
||||
|
||||
$webClient = New-Object System.Net.WebClient
|
||||
|
|
|
|||
Loading…
Reference in New Issue