2016-03-07 20:24:36 +00:00
|
|
|
#
|
|
|
|
# Copyright (c) .NET Foundation and contributors. All rights reserved.
|
|
|
|
# Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
|
|
|
#
|
|
|
|
|
|
|
|
param(
|
2017-02-14 01:03:36 +00:00
|
|
|
[switch]$Help,
|
|
|
|
[switch]$Update)
|
2016-03-07 20:24:36 +00:00
|
|
|
|
|
|
|
if($Help)
|
|
|
|
{
|
2017-05-26 22:46:56 +00:00
|
|
|
Write-Output "Usage: .\update-dependencies.ps1"
|
|
|
|
Write-Output ""
|
|
|
|
Write-Output "Options:"
|
|
|
|
Write-Output " -Help Display this help message"
|
|
|
|
Write-Output " -Update Update dependencies (but don't open a PR)"
|
2016-03-07 20:24:36 +00:00
|
|
|
exit 0
|
|
|
|
}
|
|
|
|
|
2016-06-02 19:08:39 +00:00
|
|
|
$Architecture='x64'
|
|
|
|
|
2016-05-26 03:04:26 +00:00
|
|
|
$RepoRoot = "$PSScriptRoot\..\.."
|
2017-02-09 22:25:48 +00:00
|
|
|
$ProjectPath = "$PSScriptRoot\update-dependencies.csproj"
|
2017-02-14 01:03:36 +00:00
|
|
|
$ProjectArgs = ""
|
|
|
|
|
|
|
|
if ($Update)
|
|
|
|
{
|
|
|
|
$ProjectArgs = "--Update"
|
|
|
|
}
|
2016-05-26 03:04:26 +00:00
|
|
|
|
2016-03-07 20:24:36 +00:00
|
|
|
# Use a repo-local install directory (but not the artifacts directory because that gets cleaned a lot
|
|
|
|
if (!$env:DOTNET_INSTALL_DIR)
|
|
|
|
{
|
2018-08-02 00:34:27 +00:00
|
|
|
$env:DOTNET_INSTALL_DIR="$RepoRoot\.dotnet_stage0\update-dependencies"
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!(Test-Path $env:DOTNET_INSTALL_DIR))
|
|
|
|
{
|
|
|
|
mkdir $env:DOTNET_INSTALL_DIR | Out-Null
|
2016-03-07 20:24:36 +00:00
|
|
|
}
|
|
|
|
|
2017-09-06 20:27:16 +00:00
|
|
|
$env:DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1
|
|
|
|
|
2016-03-07 20:24:36 +00:00
|
|
|
# Install a stage 0
|
2017-10-17 15:10:22 +00:00
|
|
|
Write-Output "Installing .NET Core CLI Stage 0"
|
|
|
|
|
2018-08-02 00:34:27 +00:00
|
|
|
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
|
|
|
|
$dotnetInstallPath = Join-Path $env:DOTNET_INSTALL_DIR "dotnet-install.ps1"
|
|
|
|
|
|
|
|
Write-Output "dotnet-install path: $dotnetInstallPath"
|
|
|
|
Invoke-WebRequest -Uri "https://dot.net/v1/dotnet-install.ps1" -OutFile "$dotnetInstallPath"
|
|
|
|
|
|
|
|
|
2017-10-17 15:10:22 +00:00
|
|
|
if (!$env:DOTNET_TOOL_DIR)
|
|
|
|
{
|
2018-08-02 00:34:27 +00:00
|
|
|
& "$dotnetInstallPath" -version "2.1.302" -Architecture $Architecture
|
2017-10-17 15:10:22 +00:00
|
|
|
if($LASTEXITCODE -ne 0) { throw "Failed to install stage0" }
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2017-10-17 21:32:36 +00:00
|
|
|
Copy-Item -Force -Recurse $env:DOTNET_TOOL_DIR $env:DOTNET_INSTALL_DIR
|
2017-10-17 15:10:22 +00:00
|
|
|
}
|
2016-03-07 20:24:36 +00:00
|
|
|
|
|
|
|
# Put the stage0 on the path
|
2016-03-25 21:47:59 +00:00
|
|
|
$env:PATH = "$env:DOTNET_INSTALL_DIR;$env:PATH"
|
2016-03-07 20:24:36 +00:00
|
|
|
|
|
|
|
# Run the app
|
2017-05-26 22:46:56 +00:00
|
|
|
Write-Output "Invoking App $ProjectPath..."
|
2017-02-14 01:03:36 +00:00
|
|
|
dotnet run -p "$ProjectPath" "$ProjectArgs"
|
2016-03-07 20:24:36 +00:00
|
|
|
if($LASTEXITCODE -ne 0) { throw "Build failed" }
|