remove PackageManagemnt before installing the correct one

This commit is contained in:
Travis Plunk
2018-07-05 18:01:33 -07:00
parent 19118e0532
commit b2a1ff2b23
+3 -1
View File
@@ -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)