代码拉取完成,页面将自动刷新
function Install-Dotnet
{
$installDotnet = $true
try
{
# Check that the dotnet.exe command exists
Get-Command dotnet.exe 2>&1 | Out-Null
# Read the version from global.json
$globalJson = Get-Content .\global.json | ConvertFrom-Json
$requiredVersion = $globalJson.sdk.version
# Check versions already installed
$localVersions = dotnet --list-sdks |% { $_.Split(" ")[0] }
Write-Output "Required SDK: $requiredVersion"
Write-Output "Installed SDKs: $localversions"
# If the required version is not installed, we will call the installation script
$installDotnet = !$localVersions.Contains($globalJson.sdk.version)
}
catch
{
Write-Output "dotnet not found"
# do nothing, we will install dotnet
}
if ($installDotnet)
{
Write-Output "Installing dotnet ${requiredVersion}"
New-Item -ItemType Directory -Force -Path .\Tools | Out-Null
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
Invoke-WebRequest `
-Uri "https://dot.net/v1/dotnet-install.ps1" `
-OutFile ".\Tools\dotnet-install.ps1"
& .\Tools\dotnet-install.ps1 -InstallDir Tools\dotnetcli\ -JSonFile .\global.json
}
}
function Invoke-Dotnet
{
param
(
$Command,
$Arguments
)
$cmdArgs = @()
$cmdArgs = $cmdArgs + $Command
$cmdArgs = $cmdArgs + ($Arguments -split "\s+")
Write-Output "dotnet $cmdArgs"
& dotnet $cmdArgs
if ($LASTEXITCODE -ne 0)
{
Write-Error "===== Build FAILED -- $Command with error $LASTEXITCODE - CANNOT CONTINUE ====="
Exit $LASTEXITCODE
}
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。