Merge remote-tracking branch 'refs/remotes/origin/rel/1.0.0'
Conflicts: scripts/obtain/dotnet-install.ps1 src/dotnet/commands/dotnet-new/CSharp_xunittest/project.json.template
This commit is contained in:
commit
1ce482a8d1
3 changed files with 42 additions and 27 deletions
64
scripts/obtain/dotnet-install.ps1
vendored
64
scripts/obtain/dotnet-install.ps1
vendored
|
@ -126,6 +126,36 @@ function Load-Assembly([string] $Assembly) {
|
|||
}
|
||||
}
|
||||
|
||||
function GetHTTPResponse([Uri] $Uri)
|
||||
{
|
||||
$HttpClient = $null
|
||||
|
||||
try {
|
||||
# HttpClient is used vs Invoke-WebRequest in order to support Nano Server which doesn't support the Invoke-WebRequest cmdlet.
|
||||
Load-Assembly -Assembly System.Net.Http
|
||||
$HttpClient = New-Object System.Net.Http.HttpClient
|
||||
$Response = $HttpClient.GetAsync($Uri).Result
|
||||
if (($Response -eq $null) -or (-not ($Response.IsSuccessStatusCode)))
|
||||
{
|
||||
$ErrorMsg = "Failed to download $Uri."
|
||||
if ($Response -ne $null)
|
||||
{
|
||||
$ErrorMsg += " $Response"
|
||||
}
|
||||
|
||||
throw $ErrorMsg
|
||||
}
|
||||
|
||||
return $Response
|
||||
}
|
||||
finally {
|
||||
if ($HttpClient -ne $null) {
|
||||
$HttpClient.Dispose()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function Get-Latest-Version-Info([string]$AzureFeed, [string]$AzureChannel, [string]$CLIArchitecture) {
|
||||
Say-Invocation $MyInvocation
|
||||
|
||||
|
@ -137,25 +167,14 @@ function Get-Latest-Version-Info([string]$AzureFeed, [string]$AzureChannel, [str
|
|||
$VersionFileUrl = "$UncachedFeed/Sdk/$AzureChannel/latest.version"
|
||||
}
|
||||
|
||||
try {
|
||||
# HttpClient is used vs Invoke-WebRequest in order to support Nano Server which doesn't support the Invoke-WebRequest cmdlet.
|
||||
Load-Assembly -Assembly System.Net.Http
|
||||
$HttpClient = New-Object System.Net.Http.HttpClient
|
||||
$Response = $HttpClient.GetAsync($VersionFileUrl).Result
|
||||
$StringContent = $Response.Content.ReadAsStringAsync().Result
|
||||
$Response = GetHTTPResponse -Uri $VersionFileUrl
|
||||
$StringContent = $Response.Content.ReadAsStringAsync().Result
|
||||
|
||||
switch ($Response.Content.Headers.ContentType) {
|
||||
{ ($_ -eq "application/octet-stream") } { $VersionText = [Text.Encoding]::UTF8.GetString($StringContent) }
|
||||
{ ($_ -eq "text/plain") } { $VersionText = $StringContent }
|
||||
default { throw "``$Response.Content.Headers.ContentType`` is an unknown .version file content type." }
|
||||
}
|
||||
switch ($Response.Content.Headers.ContentType) {
|
||||
{ ($_ -eq "application/octet-stream") } { $VersionText = [Text.Encoding]::UTF8.GetString($StringContent) }
|
||||
{ ($_ -eq "text/plain") } { $VersionText = $StringContent }
|
||||
default { throw "``$Response.Content.Headers.ContentType`` is an unknown .version file content type." }
|
||||
}
|
||||
finally {
|
||||
if ($HttpClient -ne $null) {
|
||||
$HttpClient.Dispose()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$VersionInfo = Get-Version-Info-From-Version-Text $VersionText
|
||||
|
||||
|
@ -331,19 +350,16 @@ function Extract-Dotnet-Package([string]$ZipPath, [string]$OutPath) {
|
|||
}
|
||||
|
||||
function DownloadFile([Uri]$Uri, [string]$OutPath) {
|
||||
$Stream = $null
|
||||
|
||||
try {
|
||||
# HttpClient is used vs Invoke-WebRequest in order to support Nano Server which doesn't support the Invoke-WebRequest cmdlet.
|
||||
Load-Assembly -Assembly System.Net.Http
|
||||
$HttpClient = New-Object System.Net.Http.HttpClient
|
||||
$Stream = $HttpClient.GetAsync($Uri).Result.Content.ReadAsStreamAsync().Result
|
||||
$Response = GetHTTPResponse -Uri $Uri
|
||||
$Stream = $Response.Content.ReadAsStreamAsync().Result
|
||||
$File = [System.IO.File]::Create($OutPath)
|
||||
$Stream.CopyTo($File)
|
||||
$File.Close()
|
||||
}
|
||||
finally {
|
||||
if ($HttpClient -ne $null) {
|
||||
$HttpClient.Dispose()
|
||||
}
|
||||
if ($Stream -ne $null) {
|
||||
$Stream.Dispose()
|
||||
}
|
||||
|
|
|
@ -5,9 +5,8 @@
|
|||
},
|
||||
"dependencies": {
|
||||
"System.Runtime.Serialization.Primitives": "4.1.1",
|
||||
"xunit": "2.1.0",
|
||||
"dotnet-test-xunit": "1.0.0-rc2-330423-54",
|
||||
"Microsoft.DotNet.InternalAbstractions": "1.0.0"
|
||||
"xunit": "2.2.0-beta2-build3300",
|
||||
"dotnet-test-xunit": "2.2.0-preview2-build1029"
|
||||
},
|
||||
"testRunner": "xunit",
|
||||
"frameworks": {
|
||||
|
|
Loading…
Reference in a new issue