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) {
|
function Get-Latest-Version-Info([string]$AzureFeed, [string]$AzureChannel, [string]$CLIArchitecture) {
|
||||||
Say-Invocation $MyInvocation
|
Say-Invocation $MyInvocation
|
||||||
|
|
||||||
|
@ -137,25 +167,14 @@ function Get-Latest-Version-Info([string]$AzureFeed, [string]$AzureChannel, [str
|
||||||
$VersionFileUrl = "$UncachedFeed/Sdk/$AzureChannel/latest.version"
|
$VersionFileUrl = "$UncachedFeed/Sdk/$AzureChannel/latest.version"
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
$Response = GetHTTPResponse -Uri $VersionFileUrl
|
||||||
# HttpClient is used vs Invoke-WebRequest in order to support Nano Server which doesn't support the Invoke-WebRequest cmdlet.
|
$StringContent = $Response.Content.ReadAsStringAsync().Result
|
||||||
Load-Assembly -Assembly System.Net.Http
|
|
||||||
$HttpClient = New-Object System.Net.Http.HttpClient
|
|
||||||
$Response = $HttpClient.GetAsync($VersionFileUrl).Result
|
|
||||||
$StringContent = $Response.Content.ReadAsStringAsync().Result
|
|
||||||
|
|
||||||
switch ($Response.Content.Headers.ContentType) {
|
switch ($Response.Content.Headers.ContentType) {
|
||||||
{ ($_ -eq "application/octet-stream") } { $VersionText = [Text.Encoding]::UTF8.GetString($StringContent) }
|
{ ($_ -eq "application/octet-stream") } { $VersionText = [Text.Encoding]::UTF8.GetString($StringContent) }
|
||||||
{ ($_ -eq "text/plain") } { $VersionText = $StringContent }
|
{ ($_ -eq "text/plain") } { $VersionText = $StringContent }
|
||||||
default { throw "``$Response.Content.Headers.ContentType`` is an unknown .version file content type." }
|
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
|
$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) {
|
function DownloadFile([Uri]$Uri, [string]$OutPath) {
|
||||||
|
$Stream = $null
|
||||||
|
|
||||||
try {
|
try {
|
||||||
# HttpClient is used vs Invoke-WebRequest in order to support Nano Server which doesn't support the Invoke-WebRequest cmdlet.
|
$Response = GetHTTPResponse -Uri $Uri
|
||||||
Load-Assembly -Assembly System.Net.Http
|
$Stream = $Response.Content.ReadAsStreamAsync().Result
|
||||||
$HttpClient = New-Object System.Net.Http.HttpClient
|
|
||||||
$Stream = $HttpClient.GetAsync($Uri).Result.Content.ReadAsStreamAsync().Result
|
|
||||||
$File = [System.IO.File]::Create($OutPath)
|
$File = [System.IO.File]::Create($OutPath)
|
||||||
$Stream.CopyTo($File)
|
$Stream.CopyTo($File)
|
||||||
$File.Close()
|
$File.Close()
|
||||||
}
|
}
|
||||||
finally {
|
finally {
|
||||||
if ($HttpClient -ne $null) {
|
|
||||||
$HttpClient.Dispose()
|
|
||||||
}
|
|
||||||
if ($Stream -ne $null) {
|
if ($Stream -ne $null) {
|
||||||
$Stream.Dispose()
|
$Stream.Dispose()
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,9 +5,8 @@
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"System.Runtime.Serialization.Primitives": "4.1.1",
|
"System.Runtime.Serialization.Primitives": "4.1.1",
|
||||||
"xunit": "2.1.0",
|
"xunit": "2.2.0-beta2-build3300",
|
||||||
"dotnet-test-xunit": "1.0.0-rc2-330423-54",
|
"dotnet-test-xunit": "2.2.0-preview2-build1029"
|
||||||
"Microsoft.DotNet.InternalAbstractions": "1.0.0"
|
|
||||||
},
|
},
|
||||||
"testRunner": "xunit",
|
"testRunner": "xunit",
|
||||||
"frameworks": {
|
"frameworks": {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue