Merge remote-tracking branch 'libtemplate/microbuild' into libtemplateUpdate
This commit is contained in:
Коммит
ff6e334707
|
@ -0,0 +1,30 @@
|
||||||
|
{
|
||||||
|
"version": 1,
|
||||||
|
"isRoot": true,
|
||||||
|
"tools": {
|
||||||
|
"powershell": {
|
||||||
|
"version": "7.3.3",
|
||||||
|
"commands": [
|
||||||
|
"pwsh"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"dotnet-format": {
|
||||||
|
"version": "5.1.250801",
|
||||||
|
"commands": [
|
||||||
|
"dotnet-format"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"dotnet-coverage": {
|
||||||
|
"version": "17.6.11",
|
||||||
|
"commands": [
|
||||||
|
"dotnet-coverage"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"nbgv": {
|
||||||
|
"version": "3.5.119",
|
||||||
|
"commands": [
|
||||||
|
"nbgv"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -3,7 +3,7 @@
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
|
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
|
||||||
<CentralPackageTransitivePinningEnabled>true</CentralPackageTransitivePinningEnabled>
|
<CentralPackageTransitivePinningEnabled>true</CentralPackageTransitivePinningEnabled>
|
||||||
<MicroBuildVersion>2.0.113</MicroBuildVersion>
|
<MicroBuildVersion>2.0.115</MicroBuildVersion>
|
||||||
<CodeAnalysisVersion>3.11.0</CodeAnalysisVersion>
|
<CodeAnalysisVersion>3.11.0</CodeAnalysisVersion>
|
||||||
<CodeAnalysisVersion Condition="'$(IsTestProject)'=='true'">4.4.0</CodeAnalysisVersion>
|
<CodeAnalysisVersion Condition="'$(IsTestProject)'=='true'">4.4.0</CodeAnalysisVersion>
|
||||||
<CodefixTestingVersion>1.1.1</CodefixTestingVersion>
|
<CodefixTestingVersion>1.1.1</CodefixTestingVersion>
|
||||||
|
@ -20,7 +20,6 @@
|
||||||
<PackageVersion Include="Microsoft.CodeAnalysis.PublicApiAnalyzers" Version="3.3.0-beta2.final" />
|
<PackageVersion Include="Microsoft.CodeAnalysis.PublicApiAnalyzers" Version="3.3.0-beta2.final" />
|
||||||
<PackageVersion Include="Microsoft.CodeAnalysis.VisualBasic" Version="$(CodeAnalysisVersion)" />
|
<PackageVersion Include="Microsoft.CodeAnalysis.VisualBasic" Version="$(CodeAnalysisVersion)" />
|
||||||
<PackageVersion Include="Microsoft.CodeAnalysis.VisualBasic.CodeFix.Testing.XUnit" Version="$(CodefixTestingVersion)" />
|
<PackageVersion Include="Microsoft.CodeAnalysis.VisualBasic.CodeFix.Testing.XUnit" Version="$(CodefixTestingVersion)" />
|
||||||
<PackageVersion Include="Microsoft.CodeCoverage" Version="17.5.0" />
|
|
||||||
<PackageVersion Include="Microsoft.Diagnostics.Runtime.Utilities" Version="$(MicrosoftDiagnosticsRuntimeVersion)" />
|
<PackageVersion Include="Microsoft.Diagnostics.Runtime.Utilities" Version="$(MicrosoftDiagnosticsRuntimeVersion)" />
|
||||||
<PackageVersion Include="Microsoft.Diagnostics.Runtime" Version="$(MicrosoftDiagnosticsRuntimeVersion)" />
|
<PackageVersion Include="Microsoft.Diagnostics.Runtime" Version="$(MicrosoftDiagnosticsRuntimeVersion)" />
|
||||||
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.5.0" />
|
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.5.0" />
|
||||||
|
|
|
@ -1,24 +0,0 @@
|
||||||
<#
|
|
||||||
.SYNOPSIS
|
|
||||||
Gets the path to the nbgv CLI tool, installing it if necessary.
|
|
||||||
#>
|
|
||||||
Param(
|
|
||||||
)
|
|
||||||
|
|
||||||
$existingTool = Get-Command "nbgv" -ErrorAction SilentlyContinue
|
|
||||||
if ($existingTool) {
|
|
||||||
return $existingTool.Path
|
|
||||||
}
|
|
||||||
|
|
||||||
$toolInstallDir = & "$PSScriptRoot/Get-TempToolsPath.ps1"
|
|
||||||
|
|
||||||
$toolPath = "$toolInstallDir/nbgv"
|
|
||||||
if (!(Test-Path $toolInstallDir)) { New-Item -Path $toolInstallDir -ItemType Directory | Out-Null }
|
|
||||||
|
|
||||||
if (!(Get-Command $toolPath -ErrorAction SilentlyContinue)) {
|
|
||||||
Write-Host "Installing nbgv to $toolInstallDir"
|
|
||||||
dotnet tool install --tool-path "$toolInstallDir" nbgv --configfile "$PSScriptRoot/justnugetorg.nuget.config" | Out-Null
|
|
||||||
}
|
|
||||||
|
|
||||||
# Normalize the path on the way out.
|
|
||||||
return (Get-Command $toolPath).Path
|
|
|
@ -20,32 +20,32 @@ Param(
|
||||||
)
|
)
|
||||||
|
|
||||||
$RepoRoot = [string](Resolve-Path $PSScriptRoot/..)
|
$RepoRoot = [string](Resolve-Path $PSScriptRoot/..)
|
||||||
|
Push-Location $RepoRoot
|
||||||
|
try {
|
||||||
|
Write-Verbose "Searching $Path for *.cobertura.xml files"
|
||||||
|
$reports = Get-ChildItem -Recurse $Path -Filter *.cobertura.xml
|
||||||
|
|
||||||
if (!(Test-Path $RepoRoot/obj/dotnet-coverage*)) {
|
if ($reports) {
|
||||||
dotnet tool install --tool-path $RepoRoot/obj dotnet-coverage --version 17.4.3 --configfile $PSScriptRoot/justnugetorg.nuget.config
|
$reports |% { $_.FullName } |% {
|
||||||
}
|
# In addition to replacing {reporoot}, we also normalize on one kind of slash so that the report aggregates data for a file whether data was collected on Windows or not.
|
||||||
|
$xml = [xml](Get-Content -Path $_)
|
||||||
|
$xml.coverage.packages.package.classes.class |? { $_.filename} |% {
|
||||||
|
$_.filename = $_.filename.Replace('{reporoot}', $RepoRoot).Replace([IO.Path]::AltDirectorySeparatorChar, [IO.Path]::DirectorySeparatorChar)
|
||||||
|
}
|
||||||
|
|
||||||
Write-Verbose "Searching $Path for *.cobertura.xml files"
|
$xml.Save($_)
|
||||||
$reports = Get-ChildItem -Recurse $Path -Filter *.cobertura.xml
|
|
||||||
|
|
||||||
if ($reports) {
|
|
||||||
$reports |% { $_.FullName } |% {
|
|
||||||
# In addition to replacing {reporoot}, we also normalize on one kind of slash so that the report aggregates data for a file whether data was collected on Windows or not.
|
|
||||||
$xml = [xml](Get-Content -Path $_)
|
|
||||||
$xml.coverage.packages.package.classes.class |? { $_.filename} |% {
|
|
||||||
$_.filename = $_.filename.Replace('{reporoot}', $RepoRoot).Replace([IO.Path]::AltDirectorySeparatorChar, [IO.Path]::DirectorySeparatorChar)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$xml.Save($_)
|
$Inputs = $reports |% { Resolve-Path -relative $_.FullName }
|
||||||
|
|
||||||
|
if ((Split-Path $OutputFile) -and -not (Test-Path (Split-Path $OutputFile))) {
|
||||||
|
New-Item -Type Directory -Path (Split-Path $OutputFile) | Out-Null
|
||||||
|
}
|
||||||
|
|
||||||
|
& dotnet tool run dotnet-coverage merge $Inputs -o $OutputFile -f cobertura
|
||||||
|
} else {
|
||||||
|
Write-Error "No reports found to merge."
|
||||||
}
|
}
|
||||||
|
} finally {
|
||||||
$Inputs = $reports |% { Resolve-Path -relative $_.FullName }
|
Pop-Location
|
||||||
|
|
||||||
if ((Split-Path $OutputFile) -and -not (Test-Path (Split-Path $OutputFile))) {
|
|
||||||
New-Item -Type Directory -Path (Split-Path $OutputFile) | Out-Null
|
|
||||||
}
|
|
||||||
|
|
||||||
& "$RepoRoot/obj/dotnet-coverage" merge $Inputs -o $OutputFile -f cobertura
|
|
||||||
} else {
|
|
||||||
Write-Error "No reports found to merge."
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,7 +33,7 @@ jobs:
|
||||||
|
|
||||||
- template: install-dependencies.yml
|
- template: install-dependencies.yml
|
||||||
|
|
||||||
- powershell: '& (./azure-pipelines/Get-nbgv.ps1) cloud -ca'
|
- script: dotnet tool run nbgv cloud -ca
|
||||||
displayName: ⚙ Set build number
|
displayName: ⚙ Set build number
|
||||||
|
|
||||||
- ${{ if eq(variables['system.collectionId'], '011b8bdf-6d56-4f87-be0d-0092136884d9') }}:
|
- ${{ if eq(variables['system.collectionId'], '011b8bdf-6d56-4f87-be0d-0092136884d9') }}:
|
||||||
|
|
|
@ -26,7 +26,7 @@ steps:
|
||||||
languages: $(LocLanguages)
|
languages: $(LocLanguages)
|
||||||
displayName: 🔧 Install MicroBuild Localization Plugin
|
displayName: 🔧 Install MicroBuild Localization Plugin
|
||||||
|
|
||||||
- task: MicroBuildSigningPlugin@3
|
- task: MicroBuildSigningPlugin@4
|
||||||
inputs:
|
inputs:
|
||||||
signType: $(SignType)
|
signType: $(SignType)
|
||||||
zipSources: false
|
zipSources: false
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"sdk": {
|
"sdk": {
|
||||||
"version": "7.0.101",
|
"version": "7.0.201",
|
||||||
"rollForward": "patch",
|
"rollForward": "patch",
|
||||||
"allowPrerelease": false
|
"allowPrerelease": false
|
||||||
},
|
},
|
||||||
|
|
11
init.ps1
11
init.ps1
|
@ -28,6 +28,8 @@
|
||||||
No effect if -NoPrerequisites is specified.
|
No effect if -NoPrerequisites is specified.
|
||||||
.PARAMETER NoRestore
|
.PARAMETER NoRestore
|
||||||
Skips the package restore step.
|
Skips the package restore step.
|
||||||
|
.PARAMETER NoToolRestore
|
||||||
|
Skips the dotnet tool restore step.
|
||||||
.PARAMETER Signing
|
.PARAMETER Signing
|
||||||
Install the MicroBuild signing plugin for building test-signed builds on desktop machines.
|
Install the MicroBuild signing plugin for building test-signed builds on desktop machines.
|
||||||
.PARAMETER Localization
|
.PARAMETER Localization
|
||||||
|
@ -57,6 +59,8 @@ Param (
|
||||||
[Parameter()]
|
[Parameter()]
|
||||||
[switch]$NoRestore,
|
[switch]$NoRestore,
|
||||||
[Parameter()]
|
[Parameter()]
|
||||||
|
[switch]$NoToolRestore,
|
||||||
|
[Parameter()]
|
||||||
[switch]$Signing,
|
[switch]$Signing,
|
||||||
[Parameter()]
|
[Parameter()]
|
||||||
[switch]$Localization,
|
[switch]$Localization,
|
||||||
|
@ -112,6 +116,13 @@ try {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!$NoToolRestore -and $PSCmdlet.ShouldProcess("dotnet tool", "restore")) {
|
||||||
|
dotnet tool restore @RestoreArguments
|
||||||
|
if ($lastexitcode -ne 0) {
|
||||||
|
throw "Failure while restoring dotnet CLI tools."
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$InstallNuGetPkgScriptPath = "$PSScriptRoot\azure-pipelines\Install-NuGetPackage.ps1"
|
$InstallNuGetPkgScriptPath = "$PSScriptRoot\azure-pipelines\Install-NuGetPackage.ps1"
|
||||||
$nugetVerbosity = 'quiet'
|
$nugetVerbosity = 'quiet'
|
||||||
if ($Verbose) { $nugetVerbosity = 'normal' }
|
if ($Verbose) { $nugetVerbosity = 'normal' }
|
||||||
|
|
|
@ -22,7 +22,6 @@
|
||||||
<ProjectReference Include="..\..\src\Microsoft.VisualStudio.Threading\Microsoft.VisualStudio.Threading.csproj" />
|
<ProjectReference Include="..\..\src\Microsoft.VisualStudio.Threading\Microsoft.VisualStudio.Threading.csproj" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Microsoft.CodeCoverage" />
|
|
||||||
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.CodeFix.Testing.XUnit" />
|
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.CodeFix.Testing.XUnit" />
|
||||||
<PackageReference Include="Microsoft.CodeAnalysis.VisualBasic.CodeFix.Testing.XUnit" />
|
<PackageReference Include="Microsoft.CodeAnalysis.VisualBasic.CodeFix.Testing.XUnit" />
|
||||||
<PackageReference Include="Microsoft.CodeAnalysis" />
|
<PackageReference Include="Microsoft.CodeAnalysis" />
|
||||||
|
|
|
@ -28,7 +28,6 @@
|
||||||
</Compile>
|
</Compile>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Microsoft.CodeCoverage" />
|
|
||||||
<PackageReference Include="Microsoft.NET.Test.Sdk" />
|
<PackageReference Include="Microsoft.NET.Test.Sdk" />
|
||||||
<PackageReference Include="Nullable" PrivateAssets="all" />
|
<PackageReference Include="Nullable" PrivateAssets="all" />
|
||||||
<PackageReference Include="System.Runtime.CompilerServices.Unsafe" />
|
<PackageReference Include="System.Runtime.CompilerServices.Unsafe" />
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
<#
|
<#
|
||||||
.SYNOPSIS
|
.SYNOPSIS
|
||||||
Installs the .NET SDK specified in the global.json file at the root of this repository,
|
Installs the .NET SDK specified in the global.json file at the root of this repository,
|
||||||
along with supporting .NET Core runtimes used for testing.
|
along with supporting .NET runtimes used for testing.
|
||||||
.DESCRIPTION
|
.DESCRIPTION
|
||||||
This MAY not require elevation, as the SDK and runtimes are installed locally to this repo location,
|
This MAY not require elevation, as the SDK and runtimes are installed locally to this repo location,
|
||||||
unless `-InstallLocality machine` is specified.
|
unless `-InstallLocality machine` is specified.
|
||||||
|
@ -15,14 +15,20 @@
|
||||||
When using 'repo', environment variables are set to cause the locally installed dotnet SDK to be used.
|
When using 'repo', environment variables are set to cause the locally installed dotnet SDK to be used.
|
||||||
Per-repo can lead to file locking issues when dotnet.exe is left running as a build server and can be mitigated by running `dotnet build-server shutdown`.
|
Per-repo can lead to file locking issues when dotnet.exe is left running as a build server and can be mitigated by running `dotnet build-server shutdown`.
|
||||||
Per-machine requires elevation and will download and install all SDKs and runtimes to machine-wide locations so all applications can find it.
|
Per-machine requires elevation and will download and install all SDKs and runtimes to machine-wide locations so all applications can find it.
|
||||||
|
.PARAMETER SdkOnly
|
||||||
|
Skips installing the runtime.
|
||||||
.PARAMETER IncludeX86
|
.PARAMETER IncludeX86
|
||||||
Installs a x86 SDK and runtimes in addition to the x64 ones. Only supported on Windows. Ignored on others.
|
Installs a x86 SDK and runtimes in addition to the x64 ones. Only supported on Windows. Ignored on others.
|
||||||
|
.PARAMETER IncludeAspNetCore
|
||||||
|
Installs the ASP.NET Core runtime along with the .NET runtime.
|
||||||
#>
|
#>
|
||||||
[CmdletBinding(SupportsShouldProcess=$true,ConfirmImpact='Medium')]
|
[CmdletBinding(SupportsShouldProcess=$true,ConfirmImpact='Medium')]
|
||||||
Param (
|
Param (
|
||||||
[ValidateSet('repo','user','machine')]
|
[ValidateSet('repo','user','machine')]
|
||||||
[string]$InstallLocality='user',
|
[string]$InstallLocality='user',
|
||||||
[switch]$IncludeX86
|
[switch]$SdkOnly,
|
||||||
|
[switch]$IncludeX86,
|
||||||
|
[switch]$IncludeAspNetCore
|
||||||
)
|
)
|
||||||
|
|
||||||
$DotNetInstallScriptRoot = "$PSScriptRoot/../obj/tools"
|
$DotNetInstallScriptRoot = "$PSScriptRoot/../obj/tools"
|
||||||
|
@ -43,37 +49,46 @@ if (!$arch) { # Windows Powershell leaves this blank
|
||||||
if ($env:PROCESSOR_ARCHITECTURE -eq 'ARM64') { $arch = 'ARM64' }
|
if ($env:PROCESSOR_ARCHITECTURE -eq 'ARM64') { $arch = 'ARM64' }
|
||||||
}
|
}
|
||||||
|
|
||||||
# Search for all .NET Core runtime versions referenced from MSBuild projects and arrange to install them.
|
# Search for all .NET runtime versions referenced from MSBuild projects and arrange to install them.
|
||||||
$runtimeVersions = @()
|
$runtimeVersions = @()
|
||||||
$windowsDesktopRuntimeVersions = @()
|
$windowsDesktopRuntimeVersions = @()
|
||||||
Get-ChildItem "$PSScriptRoot\..\src\*.*proj","$PSScriptRoot\..\test\*.*proj","$PSScriptRoot\..\Directory.Build.props" -Recurse |% {
|
$aspnetRuntimeVersions = @()
|
||||||
$projXml = [xml](Get-Content -Path $_)
|
if (!$SdkOnly) {
|
||||||
$pg = $projXml.Project.PropertyGroup
|
Get-ChildItem "$PSScriptRoot\..\src\*.*proj","$PSScriptRoot\..\test\*.*proj","$PSScriptRoot\..\Directory.Build.props" -Recurse |% {
|
||||||
if ($pg) {
|
$projXml = [xml](Get-Content -Path $_)
|
||||||
$targetFrameworks = @()
|
$pg = $projXml.Project.PropertyGroup
|
||||||
$tf = $pg.TargetFramework
|
if ($pg) {
|
||||||
$targetFrameworks += $tf
|
$targetFrameworks = @()
|
||||||
$tfs = $pg.TargetFrameworks
|
$tf = $pg.TargetFramework
|
||||||
if ($tfs) {
|
$targetFrameworks += $tf
|
||||||
$targetFrameworks = $tfs -Split ';'
|
$tfs = $pg.TargetFrameworks
|
||||||
|
if ($tfs) {
|
||||||
|
$targetFrameworks = $tfs -Split ';'
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
$targetFrameworks |? { $_ -match 'net(?:coreapp)?(\d+\.\d+)' } |% {
|
||||||
$targetFrameworks |? { $_ -match 'net(?:coreapp)?(\d+\.\d+)' } |% {
|
$v = $Matches[1]
|
||||||
$v = $Matches[1]
|
$runtimeVersions += $v
|
||||||
$runtimeVersions += $v
|
$aspnetRuntimeVersions += $v
|
||||||
if ($v -ge '3.0' -and -not ($IsMacOS -or $IsLinux)) {
|
if ($v -ge '3.0' -and -not ($IsMacOS -or $IsLinux)) {
|
||||||
$windowsDesktopRuntimeVersions += $v
|
$windowsDesktopRuntimeVersions += $v
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
# Add target frameworks of the form: netXX
|
# Add target frameworks of the form: netXX
|
||||||
$targetFrameworks |? { $_ -match 'net(\d+\.\d+)' } |% {
|
$targetFrameworks |? { $_ -match 'net(\d+\.\d+)' } |% {
|
||||||
$v = $Matches[1]
|
$v = $Matches[1]
|
||||||
$runtimeVersions += $v
|
$runtimeVersions += $v
|
||||||
if (-not ($IsMacOS -or $IsLinux)) {
|
$aspnetRuntimeVersions += $v
|
||||||
$windowsDesktopRuntimeVersions += $v
|
if (-not ($IsMacOS -or $IsLinux)) {
|
||||||
|
$windowsDesktopRuntimeVersions += $v
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!$IncludeAspNetCore) {
|
||||||
|
$aspnetRuntimeVersions = @()
|
||||||
}
|
}
|
||||||
|
|
||||||
Function Get-FileFromWeb([Uri]$Uri, $OutDir) {
|
Function Get-FileFromWeb([Uri]$Uri, $OutDir) {
|
||||||
|
@ -92,18 +107,24 @@ Function Get-FileFromWeb([Uri]$Uri, $OutDir) {
|
||||||
}
|
}
|
||||||
|
|
||||||
Function Get-InstallerExe(
|
Function Get-InstallerExe(
|
||||||
[Version]$Version,
|
$Version,
|
||||||
$Architecture,
|
$Architecture,
|
||||||
[ValidateSet('Sdk','Runtime','WindowsDesktop')]
|
[ValidateSet('Sdk','Runtime','WindowsDesktop')]
|
||||||
[string]$sku
|
[string]$sku
|
||||||
) {
|
) {
|
||||||
# Get the latest/actual version for the specified one
|
# Get the latest/actual version for the specified one
|
||||||
if ($Version.Build -eq -1) {
|
$TypedVersion = $null
|
||||||
|
if (![Version]::TryParse($Version, [ref] $TypedVersion)) {
|
||||||
|
Write-Error "Unable to parse $Version into an a.b.c.d version. This version cannot be installed machine-wide."
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($TypedVersion.Build -eq -1) {
|
||||||
$versionInfo = -Split (Invoke-WebRequest -Uri "https://dotnetcli.blob.core.windows.net/dotnet/$sku/$Version/latest.version" -UseBasicParsing)
|
$versionInfo = -Split (Invoke-WebRequest -Uri "https://dotnetcli.blob.core.windows.net/dotnet/$sku/$Version/latest.version" -UseBasicParsing)
|
||||||
$Version = $versionInfo[-1]
|
$Version = $versionInfo[-1]
|
||||||
}
|
}
|
||||||
|
|
||||||
$majorMinor = "$($Version.Major).$($Version.Minor)"
|
$majorMinor = "$($TypedVersion.Major).$($TypedVersion.Minor)"
|
||||||
$ReleasesFile = Join-Path $DotNetInstallScriptRoot "$majorMinor\releases.json"
|
$ReleasesFile = Join-Path $DotNetInstallScriptRoot "$majorMinor\releases.json"
|
||||||
if (!(Test-Path $ReleasesFile)) {
|
if (!(Test-Path $ReleasesFile)) {
|
||||||
Get-FileFromWeb -Uri "https://dotnetcli.blob.core.windows.net/dotnet/release-metadata/$majorMinor/releases.json" -OutDir (Split-Path $ReleasesFile) | Out-Null
|
Get-FileFromWeb -Uri "https://dotnetcli.blob.core.windows.net/dotnet/release-metadata/$majorMinor/releases.json" -OutDir (Split-Path $ReleasesFile) | Out-Null
|
||||||
|
@ -116,6 +137,14 @@ Function Get-InstallerExe(
|
||||||
if ($release.$sku.version -eq $Version) {
|
if ($release.$sku.version -eq $Version) {
|
||||||
$filesElement = $release.$sku.files
|
$filesElement = $release.$sku.files
|
||||||
}
|
}
|
||||||
|
if (!$filesElement -and ($sku -eq 'sdk') -and $release.sdks) {
|
||||||
|
foreach ($sdk in $release.sdks) {
|
||||||
|
if ($sdk.version -eq $Version) {
|
||||||
|
$filesElement = $sdk.files
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if ($filesElement) {
|
if ($filesElement) {
|
||||||
foreach ($file in $filesElement) {
|
foreach ($file in $filesElement) {
|
||||||
|
@ -134,14 +163,14 @@ Function Get-InstallerExe(
|
||||||
if ($url) {
|
if ($url) {
|
||||||
Get-FileFromWeb -Uri $url -OutDir $DotNetInstallScriptRoot
|
Get-FileFromWeb -Uri $url -OutDir $DotNetInstallScriptRoot
|
||||||
} else {
|
} else {
|
||||||
Write-Error "Unable to find release of $sku v$Version"
|
throw "Unable to find release of $sku v$Version"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Function Install-DotNet($Version, $Architecture, [ValidateSet('Sdk','Runtime','WindowsDesktop')][string]$sku = 'Sdk') {
|
Function Install-DotNet($Version, $Architecture, [ValidateSet('Sdk','Runtime','WindowsDesktop','AspNetCore')][string]$sku = 'Sdk') {
|
||||||
Write-Host "Downloading .NET Core $sku $Version..."
|
Write-Host "Downloading .NET $sku $Version..."
|
||||||
$Installer = Get-InstallerExe -Version $Version -Architecture $Architecture -sku $sku
|
$Installer = Get-InstallerExe -Version $Version -Architecture $Architecture -sku $sku
|
||||||
Write-Host "Installing .NET Core $sku $Version..."
|
Write-Host "Installing .NET $sku $Version..."
|
||||||
cmd /c start /wait $Installer /install /passive /norestart
|
cmd /c start /wait $Installer /install /passive /norestart
|
||||||
if ($LASTEXITCODE -eq 3010) {
|
if ($LASTEXITCODE -eq 3010) {
|
||||||
Write-Verbose "Restart required"
|
Write-Verbose "Restart required"
|
||||||
|
@ -195,6 +224,17 @@ if ($InstallLocality -eq 'machine') {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$aspnetRuntimeVersions | Sort-Object | Get-Unique |% {
|
||||||
|
if ($PSCmdlet.ShouldProcess("ASP.NET Core $_", "Install")) {
|
||||||
|
Install-DotNet -Version $_ -sku AspNetCore -Architecture $arch
|
||||||
|
$restartRequired = $restartRequired -or ($LASTEXITCODE -eq 3010)
|
||||||
|
|
||||||
|
if ($IncludeX86) {
|
||||||
|
Install-DotNet -Version $_ -sku AspNetCore -Architecture x86
|
||||||
|
$restartRequired = $restartRequired -or ($LASTEXITCODE -eq 3010)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
if ($restartRequired) {
|
if ($restartRequired) {
|
||||||
Write-Host -ForegroundColor Yellow "System restart required"
|
Write-Host -ForegroundColor Yellow "System restart required"
|
||||||
Exit 3010
|
Exit 3010
|
||||||
|
@ -233,10 +273,10 @@ if ($IncludeX86) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($IsMacOS -or $IsLinux) {
|
if ($IsMacOS -or $IsLinux) {
|
||||||
$DownloadUri = "https://raw.githubusercontent.com/dotnet/install-scripts/781752509a890ca7520f1182e8bae71f9a53d754/src/dotnet-install.sh"
|
$DownloadUri = "https://raw.githubusercontent.com/dotnet/install-scripts/0b09de9bc136cacb5f849a6957ebd4062173c148/src/dotnet-install.sh"
|
||||||
$DotNetInstallScriptPath = "$DotNetInstallScriptRoot/dotnet-install.sh"
|
$DotNetInstallScriptPath = "$DotNetInstallScriptRoot/dotnet-install.sh"
|
||||||
} else {
|
} else {
|
||||||
$DownloadUri = "https://raw.githubusercontent.com/dotnet/install-scripts/781752509a890ca7520f1182e8bae71f9a53d754/src/dotnet-install.ps1"
|
$DownloadUri = "https://raw.githubusercontent.com/dotnet/install-scripts/0b09de9bc136cacb5f849a6957ebd4062173c148/src/dotnet-install.ps1"
|
||||||
$DotNetInstallScriptPath = "$DotNetInstallScriptRoot/dotnet-install.ps1"
|
$DotNetInstallScriptPath = "$DotNetInstallScriptRoot/dotnet-install.ps1"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -284,7 +324,7 @@ if ($IncludeX86) {
|
||||||
$dotnetRuntimeSwitches = $switches + '-Runtime','dotnet'
|
$dotnetRuntimeSwitches = $switches + '-Runtime','dotnet'
|
||||||
|
|
||||||
$runtimeVersions | Sort-Object -Unique |% {
|
$runtimeVersions | Sort-Object -Unique |% {
|
||||||
if ($PSCmdlet.ShouldProcess(".NET Core $Arch runtime $_", "Install")) {
|
if ($PSCmdlet.ShouldProcess(".NET $Arch runtime $_", "Install")) {
|
||||||
$anythingInstalled = $true
|
$anythingInstalled = $true
|
||||||
Invoke-Expression -Command "$DotNetInstallScriptPathExpression -Channel $_ -Architecture $arch -InstallDir $DotNetInstallDir $dotnetRuntimeSwitches"
|
Invoke-Expression -Command "$DotNetInstallScriptPathExpression -Channel $_ -Architecture $arch -InstallDir $DotNetInstallDir $dotnetRuntimeSwitches"
|
||||||
|
|
||||||
|
@ -297,7 +337,7 @@ $runtimeVersions | Sort-Object -Unique |% {
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($IncludeX86) {
|
if ($IncludeX86) {
|
||||||
if ($PSCmdlet.ShouldProcess(".NET Core x86 runtime $_", "Install")) {
|
if ($PSCmdlet.ShouldProcess(".NET x86 runtime $_", "Install")) {
|
||||||
$anythingInstalled = $true
|
$anythingInstalled = $true
|
||||||
Invoke-Expression -Command "$DotNetInstallScriptPathExpression -Channel $_ -Architecture x86 -InstallDir $DotNetX86InstallDir $dotnetRuntimeSwitches"
|
Invoke-Expression -Command "$DotNetInstallScriptPathExpression -Channel $_ -Architecture x86 -InstallDir $DotNetX86InstallDir $dotnetRuntimeSwitches"
|
||||||
|
|
||||||
|
@ -314,7 +354,7 @@ $runtimeVersions | Sort-Object -Unique |% {
|
||||||
$windowsDesktopRuntimeSwitches = $switches + '-Runtime','windowsdesktop'
|
$windowsDesktopRuntimeSwitches = $switches + '-Runtime','windowsdesktop'
|
||||||
|
|
||||||
$windowsDesktopRuntimeVersions | Sort-Object -Unique |% {
|
$windowsDesktopRuntimeVersions | Sort-Object -Unique |% {
|
||||||
if ($PSCmdlet.ShouldProcess(".NET Core WindowsDesktop $arch runtime $_", "Install")) {
|
if ($PSCmdlet.ShouldProcess(".NET WindowsDesktop $arch runtime $_", "Install")) {
|
||||||
$anythingInstalled = $true
|
$anythingInstalled = $true
|
||||||
Invoke-Expression -Command "$DotNetInstallScriptPathExpression -Channel $_ -Architecture $arch -InstallDir $DotNetInstallDir $windowsDesktopRuntimeSwitches"
|
Invoke-Expression -Command "$DotNetInstallScriptPathExpression -Channel $_ -Architecture $arch -InstallDir $DotNetInstallDir $windowsDesktopRuntimeSwitches"
|
||||||
|
|
||||||
|
@ -327,7 +367,7 @@ $windowsDesktopRuntimeVersions | Sort-Object -Unique |% {
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($IncludeX86) {
|
if ($IncludeX86) {
|
||||||
if ($PSCmdlet.ShouldProcess(".NET Core WindowsDesktop x86 runtime $_", "Install")) {
|
if ($PSCmdlet.ShouldProcess(".NET WindowsDesktop x86 runtime $_", "Install")) {
|
||||||
$anythingInstalled = $true
|
$anythingInstalled = $true
|
||||||
Invoke-Expression -Command "$DotNetInstallScriptPathExpression -Channel $_ -Architecture x86 -InstallDir $DotNetX86InstallDir $windowsDesktopRuntimeSwitches"
|
Invoke-Expression -Command "$DotNetInstallScriptPathExpression -Channel $_ -Architecture x86 -InstallDir $DotNetX86InstallDir $windowsDesktopRuntimeSwitches"
|
||||||
|
|
||||||
|
@ -341,10 +381,40 @@ $windowsDesktopRuntimeVersions | Sort-Object -Unique |% {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$aspnetRuntimeSwitches = $switches + '-Runtime','aspnetcore'
|
||||||
|
|
||||||
|
$aspnetRuntimeVersions | Sort-Object -Unique |% {
|
||||||
|
if ($PSCmdlet.ShouldProcess(".NET ASP.NET Core $arch runtime $_", "Install")) {
|
||||||
|
$anythingInstalled = $true
|
||||||
|
Invoke-Expression -Command "$DotNetInstallScriptPathExpression -Channel $_ -Architecture $arch -InstallDir $DotNetInstallDir $aspnetRuntimeSwitches"
|
||||||
|
|
||||||
|
if ($LASTEXITCODE -ne 0) {
|
||||||
|
Write-Error ".NET SDK installation failure: $LASTEXITCODE"
|
||||||
|
exit $LASTEXITCODE
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
Invoke-Expression -Command "$DotNetInstallScriptPathExpression -Channel $_ -Architecture $arch -InstallDir $DotNetInstallDir $aspnetRuntimeSwitches -DryRun"
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($IncludeX86) {
|
||||||
|
if ($PSCmdlet.ShouldProcess(".NET ASP.NET Core x86 runtime $_", "Install")) {
|
||||||
|
$anythingInstalled = $true
|
||||||
|
Invoke-Expression -Command "$DotNetInstallScriptPathExpression -Channel $_ -Architecture x86 -InstallDir $DotNetX86InstallDir $aspnetRuntimeSwitches"
|
||||||
|
|
||||||
|
if ($LASTEXITCODE -ne 0) {
|
||||||
|
Write-Error ".NET SDK installation failure: $LASTEXITCODE"
|
||||||
|
exit $LASTEXITCODE
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
Invoke-Expression -Command "$DotNetInstallScriptPathExpression -Channel $_ -Architecture x86 -InstallDir $DotNetX86InstallDir $aspnetRuntimeSwitches -DryRun"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if ($PSCmdlet.ShouldProcess("Set DOTNET environment variables to discover these installed runtimes?")) {
|
if ($PSCmdlet.ShouldProcess("Set DOTNET environment variables to discover these installed runtimes?")) {
|
||||||
& "$PSScriptRoot/Set-EnvVars.ps1" -Variables $envVars -PrependPath $DotNetInstallDir | Out-Null
|
& "$PSScriptRoot/Set-EnvVars.ps1" -Variables $envVars -PrependPath $DotNetInstallDir | Out-Null
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($anythingInstalled -and ($InstallLocality -ne 'machine') -and !$env:TF_BUILD -and !$env:GITHUB_ACTIONS) {
|
if ($anythingInstalled -and ($InstallLocality -ne 'machine') -and !$env:TF_BUILD -and !$env:GITHUB_ACTIONS) {
|
||||||
Write-Warning ".NET Core runtimes or SDKs were installed to a non-machine location. Perform your builds or open Visual Studio from this same environment in order for tools to discover the location of these dependencies."
|
Write-Warning ".NET runtimes or SDKs were installed to a non-machine location. Perform your builds or open Visual Studio from this same environment in order for tools to discover the location of these dependencies."
|
||||||
}
|
}
|
||||||
|
|
Загрузка…
Ссылка в новой задаче