Welcome to mirror list, hosted at ThFree Co, Russian Federation.

Get-nbgv.ps1 « azure-pipelines - github.com/aspnet/MessagePack-CSharp.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 925eecddb79a20f1d98f80415681f73097ebfc4b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
<#
.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
}

if ($env:AGENT_TEMPDIRECTORY) {
    $toolInstallDir = "$env:AGENT_TEMPDIRECTORY/$env:BUILD_BUILDID"
} else {
    $toolInstallDir = "$PSScriptRoot/../obj/tools"
}

$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