-
Notifications
You must be signed in to change notification settings - Fork 94
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Save-PSResource doesn't install the correct version. #1657
Comments
I could not reproduce:
|
Its not the same scenario. I think the problem is that instead of taking the version '2024.5.20.1' as exact version, is taking it as minimum version. That's why then the version '2024.5.20.12' is taken. |
A did not find modules with similar versions: $ Save-PSResource -Name PSWriteColor -Version 0.7 -Path ./Downloads/ -IncludeXml
$ Save-PSResource -Name PSWriteColor -Version 0.71 -Path ./Downloads/ -IncludeXml
$ (dir ./Downloads/PSWriteColor/).Name
0.7
0.71 |
I also cannot reproduce the problem, at least with the The |
On second thought:
I wonder if the problem is related to that, and how such invalid-as-semver version numbers are de facto / should be handled. |
Example module from PowerShell Gallery with NuGet versioning (four digits vs. semver three, ref: https://learn.microsoft.com/en-us/nuget/concepts/package-versioning?tabs=semver20sort#where-nugetversion-diverges-from-semantic-versioning): Older than latest version: Using `-Version '1.0.1.314'` works as expected:PS > $DebugPreference = 'Continue'; Save-PSResource -Repository 'PSGallery' -TrustRepository -SkipDependencyCheck -Name 'Intune.USB.Creator' -Version '1.0.1.314' -Path 'C:\Users\olavb\Desktop\Testin'
DEBUG: In SavePSResource::ProcessSaveHelper()
DEBUG: In InstallHelper::BeginInstallPackages()
DEBUG: Parameters passed in >>> Name: 'Intune.USB.Creator'; VersionRange: '1.0.1.314'; NuGetVersion: '1.0.1.314'; VersionType: 'SpecificVersion'; Version: '1.0.1.314'; Prerelease: 'False'; Repository: 'PSGallery'; AcceptLicense: 'True'; Quiet: 'False'; Reinstall: 'True'; TrustRepository: 'True'; NoClobber: 'False'; AsNupkg: 'False'; IncludeXml 'False'; SavePackage 'True'; TemporaryPath ''; SkipDependencyCheck: 'True'; AuthenticodeCheck: 'False'; PathsToInstallPkg: 'C:\Users\olavb\Desktop\Testin'; Scope ''
DEBUG: In InstallHelper::ProcessRepositories()
DEBUG: In InstallHelper::InstallPackages()
DEBUG: In InstallHelper::InstallPackage()
DEBUG: In V2ServerAPICalls::FindVersion()
DEBUG: In V2ServerAPICalls::HttpRequestCall()
DEBUG: Request url is 'https://www.powershellgallery.com/api/v2/FindPackagesById()?$filter=Id+eq+%27Intune.USB.Creator%27+and+NormalizedVersion+eq+%271.0.1.314%27&$inlinecount=allpages&id=%27Intune.USB.Creator%27'
DEBUG: Count from response is '1'
DEBUG: In V2ServerAPICalls::InstallVersion()
DEBUG: In V2ServerAPICalls::HttpRequestCallForContent()
DEBUG: Request url is 'https://www.powershellgallery.com/api/v2/package/Intune.USB.Creator/1.0.1.314'
DEBUG: In InstallHelper::TryInstallToTempPath()
DEBUG: In InstallHelper::DeleteExtraneousFiles()
DEBUG: Deleting 'C:\Users\olavb\AppData\Local\Temp\3df2f957-c6ce-4b30-895b-232483e64984\intune.usb.creator\1.0.1.314\Intune.USB.Creator.nuspec'
DEBUG: Deleting 'C:\Users\olavb\AppData\Local\Temp\3df2f957-c6ce-4b30-895b-232483e64984\intune.usb.creator\1.0.1.314\[Content_Types].xml'
DEBUG: Deleting 'C:\Users\olavb\AppData\Local\Temp\3df2f957-c6ce-4b30-895b-232483e64984\intune.usb.creator\1.0.1.314\_rels'
DEBUG: Deleting 'C:\Users\olavb\AppData\Local\Temp\3df2f957-c6ce-4b30-895b-232483e64984\intune.usb.creator\1.0.1.314\package'
DEBUG: In InstallHelper::TryMoveInstallContent()
DEBUG: In InstallHelper::MoveFilesIntoInstallPath()
PS> Using `-Version [1.0.1.314]` worked too in my testing (as in, did install that exact version):PS > $DebugPreference = 'Continue'; Save-PSResource -Repository 'PSGallery' -TrustRepository -SkipDependencyCheck -Name 'Intune.USB.Creator' -Version [1.0.1.314] -Path 'C:\Users\olavb\Desktop\Testin'
DEBUG: In SavePSResource::ProcessSaveHelper()
DEBUG: In InstallHelper::BeginInstallPackages()
DEBUG: Parameters passed in >>> Name: 'Intune.USB.Creator'; VersionRange: '[1.0.1.314]'; NuGetVersion: ''; VersionType: 'VersionRange'; Version: '[1.0.1.314]'; Prerelease: 'False'; Repository: 'PSGallery'; AcceptLicense: 'True'; Quiet: 'False'; Reinstall: 'True'; TrustRepository: 'True'; NoClobber: 'False'; AsNupkg: 'False'; IncludeXml 'False'; SavePackage 'True'; TemporaryPath ''; SkipDependencyCheck: 'True'; AuthenticodeCheck: 'False'; PathsToInstallPkg: 'C:\Users\olavb\Desktop\Testin'; Scope ''
DEBUG: In InstallHelper::ProcessRepositories()
DEBUG: In InstallHelper::InstallPackages()
DEBUG: In InstallHelper::InstallPackage()
DEBUG: In V2ServerAPICalls::FindVersionGlobbing()
DEBUG: In V2ServerAPICalls::FindVersionGlobbing()
DEBUG: In V2ServerAPICalls::HttpRequestCall()
DEBUG: Request url is 'https://www.powershellgallery.com/api/v2/FindPackagesById()?$filter=NormalizedVersion+ge+%271.0.1.314%27+and+NormalizedVersion+le+%271.0.1.314%27+and+IsPrerelease+eq+false+and+Id+eq+%27Intune.USB.Creator%27&$inlinecount=allpages&$skip=0&$orderby=NormalizedVersion+desc&id=%27Intune.USB.Creator%27'
DEBUG: In V2ServerAPICalls::InstallVersion()
DEBUG: In V2ServerAPICalls::HttpRequestCallForContent()
DEBUG: Request url is 'https://www.powershellgallery.com/api/v2/package/Intune.USB.Creator/1.0.1.314'
DEBUG: In InstallHelper::TryInstallToTempPath()
DEBUG: In InstallHelper::DeleteExtraneousFiles()
DEBUG: Deleting 'C:\Users\olavb\AppData\Local\Temp\7b6a0df7-cdec-4637-9554-5c390d37609a\intune.usb.creator\1.0.1.314\Intune.USB.Creator.nuspec'
DEBUG: Deleting 'C:\Users\olavb\AppData\Local\Temp\7b6a0df7-cdec-4637-9554-5c390d37609a\intune.usb.creator\1.0.1.314\[Content_Types].xml'
DEBUG: Deleting 'C:\Users\olavb\AppData\Local\Temp\7b6a0df7-cdec-4637-9554-5c390d37609a\intune.usb.creator\1.0.1.314\_rels'
DEBUG: Deleting 'C:\Users\olavb\AppData\Local\Temp\7b6a0df7-cdec-4637-9554-5c390d37609a\intune.usb.creator\1.0.1.314\package'
DEBUG: In InstallHelper::TryMoveInstallContent()
DEBUG: In InstallHelper::MoveFilesIntoInstallPath()
PS > Not an issue? Might be an API issue with whatever backend OP used? I used PSResourceGet v1.0.5 against PSGallery. |
Prerequisites
Steps to reproduce
I am experiencing a problem with
Save-PSResource
. When installing a specific version of a module from a NuGet server, it doesn't take the one specified.Steps to reproduce:
Expected behavior
Actual behavior
Error details
No response
Environment data
Visuals
No response
The text was updated successfully, but these errors were encountered: