OneGet / oneget

PackageManagement (aka OneGet) is a package manager for Windows
MIT License
2.38k stars 190 forks source link

Import-PackageProvider should import the recently installed latest version with -Force option #348

Open bmanikm opened 6 years ago

bmanikm commented 6 years ago

Repro steps

Install-Module PowerShellGet -Force
Get-PackageProvider
Get-PackageProvider PowerShellGet -ListAvailable
Import-PackageProvider PowerShellGet -Force
Get-PackageProvider

Expected Behavior

Import-PackageProvider should import the newly installed version.

Current Behavior

Import-PackageProvider doesn't import the recently installed version, instead it re-imports the currently imported version

PS C:\WINDOWS\system32> Install-Module PowerShellGet -Force -Repository PSGallery
PS C:\WINDOWS\system32> Get-PackageProvider

Name                     Version          DynamicOptions
----                     -------          --------------
msi                      3.0.0.0          AdditionalArguments
msu                      3.0.0.0
NuGet                    2.8.5.208        Destination, ExcludeVersion, Scope, SkipDependencies, Headers, FilterOnTag, Contains, AllowPrereleaseVersions, ConfigFile, SkipValidate
PowerShellGet            1.0.0.1          PackageManagementProvider, Type, Scope, AllowClobber, SkipPublisherCheck, InstallUpdate, NoPathUpdate, Filter, Tag, Includes, DscResource, RoleCapability, Command, PublishLocation, ScriptSourceLocation, ScriptPublishLocation
Programs                 3.0.0.0          IncludeWindowsInstaller, IncludeSystemComponent
PSL                      1.0.0.210        Scope, SkipHashValidation, AddToPath, RemoveFromPath

PS C:\WINDOWS\system32> Get-PackageProvider PowerShellGet -ListAvailable

Name                     Version          DynamicOptions
----                     -------          --------------
PowerShellGet            1.6.0.0          PackageManagementProvider, Type, Scope, AllowClobber, SkipPublisherCheck, InstallUpdate, NoPathUpdate, AllowPrereleaseVersions, Filter, Tag, Includes, DscResource, RoleCapability, Command, AcceptLicense, PublishLocation, Scri...
PowerShellGet            1.0.0.1          PackageManagementProvider, Type, Scope, AllowClobber, SkipPublisherCheck, InstallUpdate, NoPathUpdate, Filter, Tag, Includes, DscResource, RoleCapability, Command, PublishLocation, ScriptSourceLocation, ScriptPublishLocation

PS C:\WINDOWS\system32> Import-PackageProvider PowerShellGet -Force -Verbose
VERBOSE: The provider 'PowerShellGet' has already been imported. Trying to import it again.
VERBOSE: Loading a PowerShell module 'C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\1.0.0.1\PSModule.psm1'.

Name                     Version          DynamicOptions
----                     -------          --------------
PowerShellGet            1.0.0.1          PackageManagementProvider, Type, Scope, AllowClobber, SkipPublisherCheck, InstallUpdate, NoPathUpdate, Filter, Tag, Includes, DscResource, RoleCapability, Command, PublishLocation, ScriptSourceLocation, ScriptPublishLocation

PS C:\WINDOWS\system32> Get-PackageProvider

Name                     Version          DynamicOptions
----                     -------          --------------
msi                      3.0.0.0          AdditionalArguments
msu                      3.0.0.0
NuGet                    2.8.5.208        Destination, ExcludeVersion, Scope, SkipDependencies, Headers, FilterOnTag, Contains, AllowPrereleaseVersions, ConfigFile, SkipValidate
PowerShellGet            1.0.0.1          PackageManagementProvider, Type, Scope, AllowClobber, SkipPublisherCheck, InstallUpdate, NoPathUpdate, Filter, Tag, Includes, DscResource, RoleCapability, Command, PublishLocation, ScriptSourceLocation, ScriptPublishLocation
Programs                 3.0.0.0          IncludeWindowsInstaller, IncludeSystemComponent
PSL                      1.0.0.210        Scope, SkipHashValidation, AddToPath, RemoveFromPath
MisinformedDNA commented 3 years ago

This would be helpful in Boxstarter scripts.