From b2a1ff2b238f644b8d2193c8fcd255b2e52b4a30 Mon Sep 17 00:00:00 2001 From: Travis Plunk Date: Thu, 5 Jul 2018 13:37:05 -0700 Subject: [PATCH] remove PackageManagemnt before installing the correct one --- build.psm1 | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/build.psm1 b/build.psm1 index 2bff622634..a6ee006028 100644 --- a/build.psm1 +++ b/build.psm1 @@ -653,8 +653,10 @@ function Restore-PSModuleToBuild # Restore modules from powershellgallery feed # PowerShellGet depends on PackageManagement module, so we will install PackageManagement module first. - Restore-PSModule -Destination $modulesDir -Name 'PackageManagement' -RequiredVersion '1.1.7.0' -SourceLocation "https://www.powershellgallery.com/api/v2/" Restore-PSModule -Destination $modulesDir -Name 'PowerShellGet' -RequiredVersion '1.6.0' -SourceLocation "https://www.powershellgallery.com/api/v2/" + # Save module will always install the newest PackageManagement when installing PowerShellGet, remove it, and install the correct one + Remove-Item (Join-Path $modulesDir -ChildPath 'PackageManagement') -Recurse + Restore-PSModule -Destination $modulesDir -Name 'PackageManagement' -RequiredVersion '1.1.7.0' -SourceLocation "https://www.powershellgallery.com/api/v2/" Restore-PSModule -Destination $modulesDir -Name 'Microsoft.PowerShell.Archive' -SourceLocation "https://www.powershellgallery.com/api/v2/" if($CI.IsPresent)