Fix 1908 - Version from API differs from manifest
PR Summary
Prefer version from the .psd1 manifest file if the version returned from the repository API is different. Else Import-Module fails, saying the manifest is not valid.
I used Copilot to mock up needed changes. I implemented and tested them with modifications myself. Built the module and thested Install-PSResource, like linked issue described.
PR Context
https://github.com/PowerShell/PSResourceGet/issues/1908
PR Checklist
- [x] PR has a meaningful title
- Use the present tense and imperative mood when describing your changes
- [x] Summarized changes
- [x] Make sure all
.h,.cpp,.cs,.ps1and.psm1files have the correct copyright header - [x] This PR is ready to merge and is not Work in Progress.
- If the PR is work in progress, please add the prefix
WIP:or[ WIP ]to the beginning of the title (theWIPbot will keep its status check atPendingwhile the prefix is present) and remove the prefix when the PR is ready.
- If the PR is work in progress, please add the prefix
-
Breaking changes
- [x] None
- OR
- [ ] Documentation needed
- [ ] Issue filed:
-
User-facing changes
- [x] Not Applicable
- OR
- [ ] Documentation needed
- [ ] Issue filed:
-
Testing - New and feature
- [ ] N/A or can only be tested interactively
- OR
- [ ] Make sure you've added a new test if existing tests do not effectively test the code changed
-
Tooling
- [x] I have considered the user experience from a tooling perspective and don't believe tooling will be impacted.
- OR
- [ ] I have considered the user experience from a tooling perspective and enumerated concerns in the summary.
Tests: Suggestions on how to test this without adding test against pwsh.gallery for this specific case? 🤔
thanks for the PR @o-l-a-v . The team needs to consider the design for the issue and decide. The design your solution suggests will be considered too, but I think we should leverage the existing version parsing and metadata file prioritization code that is already used for Local file share repositories and refactor that code out to a shared location (if not already done) for it to be used here. We would also need to consider preview versions (which are stored differently in .psd1 files versus .nuspec files), a package containing multiple .psd1 files, etc.