Add `-interactive` switch to init.ps1
This commit is contained in:
Родитель
b3a68a9e4a
Коммит
b579c7cabd
14
init.ps1
14
init.ps1
|
@ -30,6 +30,8 @@
|
|||
Skips the package restore step.
|
||||
.PARAMETER AccessToken
|
||||
An optional access token for authenticating to Azure Artifacts authenticated feeds.
|
||||
.PARAMETER Interactive
|
||||
Runs NuGet restore in interactive mode. This can turn authentication failures into authentication challenges.
|
||||
#>
|
||||
[CmdletBinding(SupportsShouldProcess = $true)]
|
||||
Param (
|
||||
|
@ -44,7 +46,9 @@ Param (
|
|||
[Parameter()]
|
||||
[switch]$NoRestore,
|
||||
[Parameter()]
|
||||
[string]$AccessToken
|
||||
[string]$AccessToken,
|
||||
[Parameter()]
|
||||
[switch]$Interactive
|
||||
)
|
||||
|
||||
$EnvVars = @{}
|
||||
|
@ -76,8 +80,14 @@ try {
|
|||
$HeaderColor = 'Green'
|
||||
|
||||
if (!$NoRestore -and $PSCmdlet.ShouldProcess("NuGet packages", "Restore")) {
|
||||
$RestoreArguments = @()
|
||||
if ($Interactive)
|
||||
{
|
||||
$RestoreArguments += '--interactive'
|
||||
}
|
||||
|
||||
Write-Host "Restoring NuGet packages" -ForegroundColor $HeaderColor
|
||||
dotnet restore
|
||||
dotnet restore @RestoreArguments
|
||||
if ($lastexitcode -ne 0) {
|
||||
throw "Failure while restoring packages."
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче