microsoft / microsoft/winget-cli

`-Version` and `-IncludePrerelease` are mutually exclusive when they shouldn't be

Open
#5,657 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Issue-Feature PowerShell
Dominant language
C++
Stars
26.4k
Forks
1.8k
Avg merge
1d 11h
Merged PRs (30d)
15

Description

Brief description of your issue

When attempting to use Repair-WinGetPackageManager I wanted to install a specific pre-release version. I included both the -Version and -IncludePrerelease options, which caused it to fail.

Steps to reproduce
PS C:\Windows\system32> Repair-WinGetPackageManager -Version 1.12.100 -IncludePrerelease
Repair-WinGetPackageManager : Parameter set cannot be resolved using the specified named parameters.
At line:1 char:1
+ Repair-WinGetPackageManager -Version 1.12.100 -IncludePrerelease
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidArgument: (:) [Repair-WinGetPackageManager], ParameterBindingException
    + FullyQualifiedErrorId : AmbiguousParameterSet,Microsoft.WinGet.Client.Commands.RepairWinGetPackageManagerCmdlet

PS C:\Windows\system32> Repair-WinGetPackageManager -Version 1.12.100-preview -IncludePrerelease
Repair-WinGetPackageManager : Parameter set cannot be resolved using the specified named parameters.
At line:1 char:1
+ Repair-WinGetPackageManager -Version 1.12.100-preview -IncludePrerele ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidArgument: (:) [Repair-WinGetPackageManager], ParameterBindingException
    + FullyQualifiedErrorId : AmbiguousParameterSet,Microsoft.WinGet.Client.Commands.RepairWinGetPackageManagerCmdlet

PS C:\Windows\system32> Repair-WinGetPackageManager -Version v1.12.100-preview -IncludePrerelease
Repair-WinGetPackageManager : Parameter set cannot be resolved using the specified named parameters.
At line:1 char:1
+ Repair-WinGetPackageManager -Version v1.12.100-preview -IncludePrerel ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidArgument: (:) [Repair-WinGetPackageManager], ParameterBindingException
    + FullyQualifiedErrorId : AmbiguousParameterSet,Microsoft.WinGet.Client.Commands.RepairWinGetPackageManagerCmd
Expected behavior

I expected that -

  1. If I specified only -Version the pre-release version would not be found
  2. If I specified both -Version and -IncludePrerelease the version would be found
Actual behavior

If I specify just -Version the pre-release version is found
If I specify both -Version and -IncludePrerelease the command throws an error that the parameter set is ambiguous

Environment
Name                           Version          Source           Summary
----                           -------          ------           -------
Microsoft.WinGet.Client        1.11.440         PSGallery        PowerShell Module for the Windows Package Manager Client.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the Repair-WinGetPackageManager command and reproduce the parameter-binding error with -Version and -IncludePrerelease using the reported examples. Trace how those parameters are assigned to parameter sets, then verify that a specific prerelease version is rejected without -IncludePrerelease and accepted when both options are supplied.

Written by the indexing model from the issue text.

Assessment

Tech stack
powershell
Domain
cli
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.