Родитель
70c8febd70
Коммит
e4cbe719a9
|
@ -3,6 +3,9 @@
|
|||
###############################################################################
|
||||
* text=auto
|
||||
|
||||
# Ensure bash shell scripts use LF line endings
|
||||
*.sh eol=lf
|
||||
|
||||
###############################################################################
|
||||
# Set default behavior for command prompt diff.
|
||||
#
|
||||
|
|
|
@ -17,8 +17,13 @@ For example if 2.2.300 is specified, you may install 2.2.300, 2.2.301, or 2.2.31
|
|||
while the 2.2.400 version would not be considered compatible by .NET SDK.
|
||||
See [.NET Core Versioning](https://docs.microsoft.com/en-us/dotnet/core/versions/) for more information.
|
||||
|
||||
All dependencies can be installed by running the `init.ps1` script at the root of the repository
|
||||
using Windows PowerShell or [PowerShell Core][pwsh] (on any OS).
|
||||
|
||||
This repository can be built on Windows, Linux, and OSX.
|
||||
|
||||
## Building
|
||||
|
||||
Building, testing, and packing this repository can be done by using the standard dotnet CLI commands (e.g. `dotnet build`, `dotnet test`, `dotnet pack`, etc.).
|
||||
|
||||
[pwsh]: https://docs.microsoft.com/en-us/powershell/scripting/install/installing-powershell?view=powershell-6
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
<#
|
||||
.SYNOPSIS
|
||||
Installs dependencies required to build and test the projects in this repository.
|
||||
#>
|
||||
[CmdletBinding(SupportsShouldProcess=$true)]
|
||||
Param (
|
||||
)
|
||||
|
||||
& "$PSScriptRoot\tools\Install-DotNetSdk.ps1"
|
|
@ -0,0 +1,54 @@
|
|||
<#
|
||||
.SYNOPSIS
|
||||
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.
|
||||
#>
|
||||
[CmdletBinding(SupportsShouldProcess=$true,ConfirmImpact='Medium')]
|
||||
Param (
|
||||
)
|
||||
|
||||
$DotNetInstallScriptRoot = Resolve-Path $PSScriptRoot\..\obj
|
||||
$sdkVersion = & "$PSScriptRoot\..\azure-pipelines\variables\DotNetSdkVersion.ps1"
|
||||
|
||||
if ($IsMacOS -or $IsLinux) {
|
||||
$DownloadUri = "https://dot.net/v1/dotnet-install.sh"
|
||||
$DotNetInstallScriptPath = "$DotNetInstallScriptRoot/dotnet-install.sh"
|
||||
} else {
|
||||
$DownloadUri = "https://dot.net/v1/dotnet-install.ps1"
|
||||
$DotNetInstallScriptPath = "$DotNetInstallScriptRoot\dotnet-install.ps1"
|
||||
}
|
||||
|
||||
if (-not (Test-Path $DotNetInstallScriptPath)) {
|
||||
Invoke-WebRequest -Uri $DownloadUri -OutFile $DotNetInstallScriptPath
|
||||
chmod +x $DotNetInstallScriptPath
|
||||
}
|
||||
|
||||
if ($PSCmdlet.ShouldProcess(".NET Core SDK $sdkVersion", "Install")) {
|
||||
& $DotNetInstallScriptPath -Version $sdkVersion -Architecture x64
|
||||
} else {
|
||||
& $DotNetInstallScriptPath -Version $sdkVersion -Architecture x64 -DryRun
|
||||
}
|
||||
|
||||
# Search for all .NET Core runtime versions referenced from MSBuild projects and arrange to install them.
|
||||
$runtimeVersions = @()
|
||||
Get-ChildItem "$PSScriptRoot\..\src\*.*proj" -Recurse |% {
|
||||
$projXml = [xml](Get-Content -Path $_)
|
||||
$targetFrameworks = $projXml.Project.PropertyGroup.TargetFramework
|
||||
if (!$targetFrameworks) {
|
||||
$targetFrameworks = $projXml.Project.PropertyGroup.TargetFrameworks
|
||||
if ($targetFrameworks) {
|
||||
$targetFrameworks = $targetFrameworks.Split(';')
|
||||
}
|
||||
}
|
||||
$targetFrameworks |? { $_ -match 'netcoreapp(\d+\.\d+)' } |% {
|
||||
$runtimeVersions += $Matches[1]
|
||||
}
|
||||
}
|
||||
|
||||
$runtimeVersions | Get-Unique |% {
|
||||
if ($PSCmdlet.ShouldProcess(".NET Core runtime $_", "Install")) {
|
||||
& $DotNetInstallScriptPath -Channel $_ -Runtime dotnet -Architecture x64
|
||||
} else {
|
||||
& $DotNetInstallScriptPath -Channel $_ -Runtime dotnet -Architecture x64 -DryRun
|
||||
}
|
||||
}
|
Загрузка…
Ссылка в новой задаче