Skip to content
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

Fix PSInstalledCatalogPackage being piped to Upgrade-WinGetPackage #3174

Merged
merged 3 commits into from Apr 26, 2023

Conversation

msftrubengu
Copy link
Contributor

@msftrubengu msftrubengu commented Apr 21, 2023

In Update-WinGetPackage, the pipeline can set the PSCatalogPackage can be set by value or property name and the Version by property name.

The result of Get-WinGetPackage piped to Update-WinGetPackage results in both properties being set. In this case, the version is not the desired version to update but the installed version. Internally, when we iterate through all the available versions of the catalog package object we will throw InvalidVersionException because well the version is not available...

To fix it, I renamed the Version property of the PSInstalledCatalogPackage to InstalledVersion to mimic what the underlying catalog package property actually is. This way the version will not be piped into Update-WinGetPackage but the caller can also specify which one it wants to update giving a better experience.

Microsoft Reviewers: Open in CodeFlow

@msftrubengu msftrubengu requested a review from a team as a code owner April 21, 2023 23:52
msftrubengu and others added 2 commits April 25, 2023 12:59
…alledCatalogPackage.cs

Co-authored-by: Ryan <69221034+ryfu-msft@users.noreply.github.com>
@msftrubengu
Copy link
Contributor Author

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@msftrubengu msftrubengu merged commit f269007 into microsoft:master Apr 26, 2023
8 checks passed
@msftrubengu msftrubengu deleted the pwsh_fixpipeline branch August 14, 2023 22:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants