@@ -303,7 +303,8 @@ function Start-PSBuild {
303
303
[ValidatePattern (" ^v\d+\.\d+\.\d+(-\w+(\.\d+)?)?$" )]
304
304
[ValidateNotNullOrEmpty ()]
305
305
[string ]$ReleaseTag ,
306
- [switch ]$Detailed
306
+ [switch ]$Detailed ,
307
+ [switch ]$InteractiveAuth
307
308
)
308
309
309
310
if ($PSCmdlet.ParameterSetName -eq " Default" -and ! $NoPSModuleRestore )
@@ -426,7 +427,7 @@ Fix steps:
426
427
}
427
428
428
429
# handle Restore
429
- Restore-PSPackage - Options $Options - Force:$Restore
430
+ Restore-PSPackage - Options $Options - Force:$Restore - InteractiveAuth: $InteractiveAuth
430
431
431
432
# handle ResGen
432
433
# Heuristic to run ResGen on the fresh machine
@@ -618,7 +619,9 @@ function Restore-PSPackage
618
619
[Parameter ()]
619
620
$Options = (Get-PSOptions - DefaultToNew),
620
621
621
- [switch ] $Force
622
+ [switch ] $Force ,
623
+
624
+ [switch ] $InteractiveAuth
622
625
)
623
626
624
627
if (-not $ProjectDirs )
@@ -654,6 +657,10 @@ function Restore-PSPackage
654
657
$RestoreArguments += " quiet"
655
658
}
656
659
660
+ if ($InteractiveAuth ) {
661
+ $RestoreArguments += " --interactive"
662
+ }
663
+
657
664
$ProjectDirs | ForEach-Object {
658
665
$project = $_
659
666
Write-Log - message " Run dotnet restore $project $RestoreArguments "
@@ -1639,7 +1646,9 @@ function Install-Dotnet {
1639
1646
[string ]$Channel = $dotnetCLIChannel ,
1640
1647
[string ]$Version = $dotnetCLIRequiredVersion ,
1641
1648
[switch ]$NoSudo ,
1642
- [string ]$InstallDir
1649
+ [string ]$InstallDir ,
1650
+ [string ]$AzureFeed ,
1651
+ [string ]$FeedCredential
1643
1652
)
1644
1653
1645
1654
# This allows sudo install to be optional; needed when running in containers / as root
@@ -1674,33 +1683,57 @@ function Install-Dotnet {
1674
1683
Start-NativeExecution {
1675
1684
& $curl - sO $installObtainUrl / $installScript
1676
1685
1677
- if (-not $InstallDir ) {
1678
- bash ./ $installScript - c $Channel - v $Version
1679
- } else {
1680
- bash ./ $installScript - c $Channel - v $Version - i $InstallDir
1686
+ $bashArgs = @ (" ./$installScript " , ' -c' , $Channel , ' -v' , $Version )
1687
+
1688
+ if ($InstallDir ) {
1689
+ $bashArgs += @ (' -i' , $InstallDir )
1690
+ }
1691
+
1692
+ if ($AzureFeed ) {
1693
+ $bashArgs += @ (' -AzureFeed' , $AzureFeed , ' -FeedCredential' , $FeedCredential )
1681
1694
}
1695
+
1696
+ bash @bashArgs
1682
1697
}
1683
1698
} elseif ($environment.IsWindows ) {
1684
1699
Remove-Item - ErrorAction SilentlyContinue - Recurse - Force ~\AppData\Local\Microsoft\dotnet
1685
1700
$installScript = " dotnet-install.ps1"
1686
1701
Invoke-WebRequest - Uri $installObtainUrl / $installScript - OutFile $installScript
1687
-
1688
1702
if (-not $environment.IsCoreCLR ) {
1689
- if (-not $InstallDir ) {
1690
- & ./ $installScript - Channel $Channel - Version $Version
1691
- } else {
1692
- & ./ $installScript - Channel $Channel - Version $Version - InstallDir $InstallDir
1703
+ $installArgs = @ {
1704
+ Channel = $Channel
1705
+ Version = $Version
1693
1706
}
1694
- } else {
1707
+
1708
+ if ($InstallDir ) {
1709
+ $installArgs += @ { InstallDir = $InstallDir }
1710
+ }
1711
+
1712
+ if ($AzureFeed ) {
1713
+ $installArgs += @ {
1714
+ AzureFeed = $AzureFeed
1715
+ $FeedCredential = $FeedCredential
1716
+ }
1717
+ }
1718
+
1719
+ & ./ $installScript @installArgs
1720
+ }
1721
+ else {
1695
1722
# dotnet-install.ps1 uses APIs that are not supported in .NET Core, so we run it with Windows PowerShell
1696
1723
$fullPSPath = Join-Path - Path $env: windir - ChildPath " System32\WindowsPowerShell\v1.0\powershell.exe"
1697
1724
$fullDotnetInstallPath = Join-Path - Path $PWD.Path - ChildPath $installScript
1698
1725
Start-NativeExecution {
1699
- if ( -not $InstallDir ) {
1700
- & $fullPSPath - NoLogo - NoProfile - File $fullDotnetInstallPath - Channel $Channel - Version $Version
1701
- } else {
1702
- & $fullPSPath - NoLogo - NoProfile - File $fullDotnetInstallPath - Channel $Channel - Version $Version - InstallDir $InstallDir
1726
+ $psArgs = @ ( ' -NoLogo ' , ' -NoProfile ' , ' -File ' , $fullDotnetInstallPath , ' -Channel ' , $Channel , ' -Version ' , $Version )
1727
+
1728
+ if ( $InstallDir ) {
1729
+ $psArgs += @ ( ' - InstallDir' , $InstallDir )
1703
1730
}
1731
+
1732
+ if ($AzureFeed ) {
1733
+ $psArgs += @ (' -AzureFeed' , $AzureFeed , ' -FeedCredential' , $FeedCredential )
1734
+ }
1735
+
1736
+ & $fullPSPath @psArgs
1704
1737
}
1705
1738
}
1706
1739
}
0 commit comments