diff --git a/build.psm1 b/build.psm1
index ce9ff123b1b..c6eb8624a41 100644
--- a/build.psm1
+++ b/build.psm1
@@ -337,7 +337,8 @@ function Start-PSBuild {
try {
# Excluded sqlite3 folder is due to this Roslyn issue: https://github.com/dotnet/roslyn/issues/23060
# Excluded src/Modules/nuget.config as this is required for release build.
- git clean -fdX --exclude .vs/PowerShell/v16/Server/sqlite3 --exclude src/Modules/nuget.config
+ # Excluded nuget.config as this is required for release build.
+ git clean -fdX --exclude .vs/PowerShell/v16/Server/sqlite3 --exclude src/Modules/nuget.config --exclude nuget.config
} finally {
Pop-Location
}
@@ -628,7 +629,9 @@ function Restore-PSPackage
[switch] $Force,
- [switch] $InteractiveAuth
+ [switch] $InteractiveAuth,
+
+ [switch] $PSModule
)
if (-not $ProjectDirs)
@@ -652,7 +655,10 @@ function Restore-PSPackage
'Microsoft.NET.Sdk'
}
- if ($Options.Runtime -notlike 'fxdependent*') {
+ if ($PSModule.IsPresent) {
+ $RestoreArguments = @("--verbosity")
+ }
+ elseif ($Options.Runtime -notlike 'fxdependent*') {
$RestoreArguments = @("--runtime", $Options.Runtime, "/property:SDKToUse=$sdkToUse", "--verbosity")
} else {
$RestoreArguments = @("/property:SDKToUse=$sdkToUse", "--verbosity")
@@ -2500,7 +2506,7 @@ function Copy-PSGalleryModules
Find-DotNet
- Restore-PSPackage -ProjectDirs (Split-Path $CsProjPath) -Force:$Force.IsPresent
+ Restore-PSPackage -ProjectDirs (Split-Path $CsProjPath) -Force:$Force.IsPresent -PSModule
$cache = dotnet nuget locals global-packages -l
if ($cache -match "global-packages: (.*)") {
@@ -3282,8 +3288,10 @@ function New-NugetConfigFile
-
+
+
+
<[FEEDNAME]>
diff --git a/nuget.config b/nuget.config
index cbb2494cecf..760e780c8ec 100644
--- a/nuget.config
+++ b/nuget.config
@@ -4,8 +4,8 @@
-
-
-
+
+
+
diff --git a/src/Modules/PSGalleryModules.csproj b/src/Modules/PSGalleryModules.csproj
index 3f7b71a07a3..63807dc1e50 100644
--- a/src/Modules/PSGalleryModules.csproj
+++ b/src/Modules/PSGalleryModules.csproj
@@ -1,6 +1,14 @@
-
+
+ PowerShell
+ Microsoft Corporation
+ (c) Microsoft Corporation.
+
+ net5.0
+
+ true
+
diff --git a/src/Modules/nuget.config b/src/Modules/nuget.config
new file mode 100644
index 00000000000..f5a7f806a36
--- /dev/null
+++ b/src/Modules/nuget.config
@@ -0,0 +1,11 @@
+
+
+
+
+
+
+
+
+
+
+
diff --git a/test/tools/Modules/nuget.config b/test/tools/Modules/nuget.config
new file mode 100644
index 00000000000..b0fc73009da
--- /dev/null
+++ b/test/tools/Modules/nuget.config
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
+
+
+
diff --git a/tools/releaseBuild/azureDevOps/AzArtifactFeed/PSGalleryToAzArtifacts.yml b/tools/releaseBuild/azureDevOps/AzArtifactFeed/PSGalleryToAzArtifacts.yml
index fab28643168..221a385b8b8 100644
--- a/tools/releaseBuild/azureDevOps/AzArtifactFeed/PSGalleryToAzArtifacts.yml
+++ b/tools/releaseBuild/azureDevOps/AzArtifactFeed/PSGalleryToAzArtifacts.yml
@@ -18,7 +18,7 @@ steps:
- pwsh: |
Import-Module -Force "$(Build.SourcesDirectory)/tools/releaseBuild/azureDevOps/AzArtifactFeed/SyncGalleryToAzArtifacts.psm1"
- SyncGalleryToAzArtifacts -AzDevOpsFeedUserName $(AzDevOpsFeedUserName) -AzDevOpsPAT $(AzDevOpsFeedPAT) -Destination $(Build.ArtifactStagingDirectory)
+ SyncGalleryToAzArtifacts -AzDevOpsFeedUserName $(AzDevOpsFeedUserName) -AzDevOpsPAT $(AzDevOpsFeedPAT2) -Destination $(Build.ArtifactStagingDirectory)
displayName: Download packages from PSGallery that need to be updated
condition: succeededOrFailed()
diff --git a/tools/releaseBuild/azureDevOps/templates/insert-nuget-config-azfeed.yml b/tools/releaseBuild/azureDevOps/templates/insert-nuget-config-azfeed.yml
index d768a876372..5fdb9f7d977 100644
--- a/tools/releaseBuild/azureDevOps/templates/insert-nuget-config-azfeed.yml
+++ b/tools/releaseBuild/azureDevOps/templates/insert-nuget-config-azfeed.yml
@@ -1,11 +1,25 @@
+parameters:
+ - name: "repoRoot"
+ default: $(REPOROOT)
+
steps:
-- powershell: |
- Import-Module $env:REPOROOT/build.psm1 -Force
- New-NugetConfigFile -NugetFeedUrl $(AzDevOpsFeed) -UserName $(AzDevOpsFeedUserName) -ClearTextPAT $(AzDevOpsFeedPAT) -FeedName AzDevOpsFeed -Destination $env:REPOROOT/src/Modules
+- pwsh: |
+ Import-Module ${{ parameters.repoRoot }}/build.psm1 -Force
+ New-NugetConfigFile -NugetFeedUrl $(AzDevOpsFeed) -UserName $(AzDevOpsFeedUserName) -ClearTextPAT $(AzDevOpsFeedPAT2) -FeedName AzDevOpsFeed -Destination '${{ parameters.repoRoot }}/src/Modules'
- if(-not (Test-Path "$env:REPOROOT/src/Modules/nuget.config"))
+ if(-not (Test-Path "${{ parameters.repoRoot }}/src/Modules/nuget.config"))
{
throw "nuget.config is not created"
}
displayName: 'Add nuget.config for Azure DevOps feed for PSGallery modules'
condition: and(succeededOrFailed(), ne(variables['AzDevOpsFeed'], ''))
+- pwsh: |
+ Import-Module ${{ parameters.repoRoot }}/build.psm1 -Force
+ New-NugetConfigFile -NugetFeedUrl $(AzDevOpsPackageFeed) -UserName $(AzDevOpsFeedUserName) -ClearTextPAT $(AzDevOpsFeedPAT2) -FeedName AzDevOpsFeed -Destination '${{ parameters.repoRoot }}'
+
+ if(-not (Test-Path "${{ parameters.repoRoot }}/nuget.config"))
+ {
+ throw "nuget.config is not created"
+ }
+ displayName: 'Add nuget.config for Azure DevOps feed for packages'
+ condition: and(succeededOrFailed(), ne(variables['AzDevOpsPackageFeed'], ''))
diff --git a/tools/releaseBuild/azureDevOps/templates/linux.yml b/tools/releaseBuild/azureDevOps/templates/linux.yml
index f8cfd397a3d..4db87a35056 100644
--- a/tools/releaseBuild/azureDevOps/templates/linux.yml
+++ b/tools/releaseBuild/azureDevOps/templates/linux.yml
@@ -42,7 +42,8 @@ jobs:
displayName: 'Skip Alpine or fxdependent for PS v6.0.*'
- template: insert-nuget-config-azfeed.yml
-
+ parameters:
+ repoRoot: $(REPOROOT)
- powershell: |
import-module "$env:REPOROOT/build.psm1"
@@ -51,7 +52,9 @@ jobs:
condition: and(succeeded(), ne(variables['SkipBuild'], 'true'))
- powershell: |
+ $env:AzDevOpsFeedPAT2 = '$(AzDevOpsFeedPAT2)'
& "$env:REPOROOT/tools/releaseBuild/vstsbuild.ps1" -ReleaseTag $(ReleaseTagVar) -Name '$(build)'
+ $env:AzDevOpsFeedPAT2 = $null
displayName: 'Build and package'
condition: and(succeeded(), ne(variables['SkipBuild'], 'true'))
diff --git a/tools/releaseBuild/azureDevOps/templates/mac.yml b/tools/releaseBuild/azureDevOps/templates/mac.yml
index f38e9b63573..6690f678888 100644
--- a/tools/releaseBuild/azureDevOps/templates/mac.yml
+++ b/tools/releaseBuild/azureDevOps/templates/mac.yml
@@ -35,20 +35,14 @@ jobs:
tools/releaseBuild/macOS/PowerShellPackageVsts.ps1 -location $(PowerShellRoot) -BootStrap
displayName: 'Bootstrap VM'
- - pwsh: |
- Import-Module $(Build.SourcesDirectory)/build.psm1 -Force
- New-NugetConfigFile -NugetFeedUrl $(AzDevOpsFeed) -UserName $(AzDevOpsFeedUserName) -ClearTextPAT $(AzDevOpsFeedPAT) -FeedName AzDevOpsFeed -Destination "$(PowerShellRoot)/src/Modules"
-
- if(-not (Test-Path "$(PowerShellRoot)/src/Modules/nuget.config"))
- {
- throw "nuget.config is not created"
- }
- displayName: 'Add nuget.config for AzDevOps feed for PSGallery modules '
+ - template: /tools/releaseBuild/azureDevOps/templates/insert-nuget-config-azfeed.yml
+ parameters:
+ repoRoot: $(PowerShellRoot)
- pwsh: |
- $env:AZDEVOPSFEEDPAT = '$(AzDevOpsFeedPAT)'
+ $env:AzDevOpsFeedPAT2 = '$(AzDevOpsFeedPAT2)'
$(Build.SourcesDirectory)/tools/releaseBuild/macOS/PowerShellPackageVsts.ps1 -ReleaseTag $(ReleaseTagVar) -Destination $(System.ArtifactsDirectory) -Symbols -location $(PowerShellRoot) -Build -ArtifactName macosBinResults
- $env:AZDEVOPSFEEDPAT = $null
+ $env:AzDevOpsFeedPAT2 = $null
displayName: 'Build'
- task: ms.vss-governance-buildtask.governance-build-task-component-detection.ComponentGovernanceComponentDetection@0
diff --git a/tools/releaseBuild/azureDevOps/templates/windows-hosted-build.yml b/tools/releaseBuild/azureDevOps/templates/windows-hosted-build.yml
index 3413896f0b2..cc05417b17b 100644
--- a/tools/releaseBuild/azureDevOps/templates/windows-hosted-build.yml
+++ b/tools/releaseBuild/azureDevOps/templates/windows-hosted-build.yml
@@ -31,10 +31,12 @@ jobs:
parameters:
ReleaseTagVar: $(ReleaseTagVar)
- - template: insert-nuget-config-azfeed.yml
-
- template: cloneToOfficialPath.yml
+ - template: /tools/releaseBuild/azureDevOps/templates/insert-nuget-config-azfeed.yml
+ parameters:
+ repoRoot: $(PowerShellRoot)
+
- powershell: |
$runtime = switch ($env:Architecture)
diff --git a/tools/releaseBuild/azureDevOps/templates/windows-packaging.yml b/tools/releaseBuild/azureDevOps/templates/windows-packaging.yml
index 0106977dff9..81eac8e5a11 100644
--- a/tools/releaseBuild/azureDevOps/templates/windows-packaging.yml
+++ b/tools/releaseBuild/azureDevOps/templates/windows-packaging.yml
@@ -60,7 +60,7 @@ jobs:
- template: cloneToOfficialPath.yml
- - powershell: |
+ - pwsh: |
# cleanup previous install
if((Test-Path "${env:ProgramFiles(x86)}\WiX Toolset xcopy")) {
Remove-Item "${env:ProgramFiles(x86)}\WiX Toolset xcopy" -Recurse -Force
@@ -68,7 +68,7 @@ jobs:
$toolsDir = New-Item -ItemType Directory -Path '$(Build.ArtifactStagingDirectory)\tools'
$wixUri = 'https://github.com/wixtoolset/wix3/releases/download/wix311rtm/wix311-binaries.zip'
- Invoke-RestMethod -Uri $wixUri -OutFile '$(Build.ArtifactStagingDirectory)\tools\wix.zip'
+ Invoke-RestMethod -Uri $wixUri -OutFile '$(Build.ArtifactStagingDirectory)\tools\wix.zip' -MaximumRetryCount 5 -RetryIntervalSec 10
Import-Module '$(PowerShellRoot)/tools/releaseBuild/Images/microsoft_powershell_windowsservercore/wix.psm1'
Install-WixZip -zipPath '$(Build.ArtifactStagingDirectory)\tools\wix.zip'