3 $versionEndpoint = 'https://maestro-prod.westus2.cloudapp.azure.com/api/assets/darc-version?api-version=2019-01-16',
4 $verbosity = 'minimal',
8 . $PSScriptRoot\tools
.ps1
10 function InstallDarcCli
($darcVersion) {
11 $darcCliPackageName = 'microsoft.dotnet.darc'
13 $dotnetRoot = InitializeDotNetCli
-install
:$true
14 $dotnet = "$dotnetRoot\dotnet.exe"
15 $toolList = & "$dotnet" tool list
-g
17 if ($toolList -like
"*$darcCliPackageName*") {
18 & "$dotnet" tool uninstall
$darcCliPackageName -g
21 # If the user didn't explicitly specify the darc version,
22 # query the Maestro API for the correct version of darc to install.
23 if (-not
$darcVersion) {
24 $darcVersion = $(Invoke-WebRequest -Uri $versionEndpoint -UseBasicParsing)
.Content
27 $arcadeServicesSource = 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools/nuget/v3/index.json'
29 Write-Host "Installing Darc CLI version $darcVersion..."
30 Write-Host 'You may need to restart your command window if this is the first dotnet tool you have installed.'
32 & "$dotnet" tool install
$darcCliPackageName --version
$darcVersion --add-source
"$arcadeServicesSource" -v
$verbosity -g
34 & "$dotnet" tool install
$darcCliPackageName --version
$darcVersion --add-source
"$arcadeServicesSource" -v
$verbosity --tool-path
"$toolpath"
39 InstallDarcCli
$darcVersion
42 Write-Host $_.ScriptStackTrace
43 Write-PipelineTelemetryError
-Category
'Darc' -Message
$_