Skip to content

Pinning/Unpinning should work for non-installed applications without --id flag #4163

Description

Brief description of your issue

As seen in #4161 (comment), winget pin remove does not remove pin for an uninstalled application without providing --id flag. I would expect that if the query is an exact / good enough match for a PackageIdentifier listed in winget pin list, then winget pin remove <PackageIdentifier> should just work.

The same extension can be made for winget pin add where a non-installed application can not be pinned without --id flag. A matching criteria similar to the one used for winget install/search can be followed to allow these pins.

If we're concerned about user pinning / unpinning an incorrect package with these enhancements, we can make the flow interactive and ask user in a (y/n) prompt.

Steps to reproduce

From #4161 (comment)

winget install Stockfish.Stockfish
winget pin add Stockfish.Stockfish
winget remove Stockfish.Stockfish
winget pin remove Stockfish.Stockfish

Expected behavior

Pin removed successfully

Actual behavior

No installed package found matching input criteria.

Environment

Windows Package Manager v1.6.3482
Copyright (c) Microsoft Corporation. All rights reserved.

Windows: Windows.Desktop v10.0.22621.3007
System Architecture: X64
Package: Microsoft.DesktopAppInstaller v1.21.3482.0

Winget Directories
----------------------------------------------------------------------------------------------------------
Logs                               %LOCALAPPDATA%\Packages\Microsoft.DesktopAppInstaller_8wekyb3d8bbwe\Lo…
User Settings                      %LOCALAPPDATA%\Packages\Microsoft.DesktopAppInstaller_8wekyb3d8bbwe\Lo…
Portable Links Directory (User)    %LOCALAPPDATA%\Microsoft\WinGet\Links
Portable Links Directory (Machine) C:\Program Files\WinGet\Links
Portable Package Root (User)       %LOCALAPPDATA%\Microsoft\WinGet\Packages
Portable Package Root              C:\Program Files\WinGet\Packages
Portable Package Root (x86)        C:\Program Files (x86)\WinGet\Packages
Installer Downloads                %USERPROFILE%\Downloads

Links
---------------------------------------------------------------------------
Privacy Statement   https://aka.ms/winget-privacy
License Agreement   https://aka.ms/winget-license
Third Party Notices https://aka.ms/winget-3rdPartyNotice
Homepage            https://aka.ms/winget
Windows Store Terms https://www.microsoft.com/en-us/storedocs/terms-of-sale

Admin Setting                             State
--------------------------------------------------
LocalManifestFiles                        Enabled
BypassCertificatePinningForMicrosoftStore Disabled
InstallerHashOverride                     Enabled
LocalArchiveMalwareScanOverride           Enabled

Activity

  1. github-actions commented on Feb 11, 2024

    @github-actions

    Hi I'm an AI powered bot that finds similar issues based off the issue title.

    Please view the issues below to see if they solve your problem, and if the issue describes your problem please consider closing this one and thumbs upping the other issue to help us prioritize it. Thank you!

    Closed similar issues:

    Note: You can give me feedback by thumbs upping or thumbs downing this comment.

  2. mdanish-kh commented on Feb 11, 2024

    @mdanish-kh
    ContributorAuthor

    Thinking more -

    I don't feel as strongly about winget pin add since there may be questions as to why user would want to pin a package that's not installed. If they really want to do it, --id allows them to add that pin.

    However for winget pin remove, if a pin is already in winget pin list, then the user should be able to remove it without --id

  3. added
    Issue-Feature
    on Mar 6, 2024
  4. masterflitzer commented on Apr 17, 2025

    @masterflitzer

    I don't feel as strongly about winget pin add since there may be questions as to why user would want to pin a package that's not installed. If they really want to do it, --id allows them to add that pin.

    to prevent misdetection, e.g. i pinned Mozilla.Thunderbird which i have installed, but one day upgrade -r just installed Mozilla.Thunderbird.ESR for some reason, so i'd rather be able to pin both while having only the one i actually want installed

    but i also don't feel strongly about this, what i do think is important tho: winget pin add -? should say that --id can do this, it's the kind of hidden behavior i wouldn't have found out without you mentioning it

    However for winget pin remove, if a pin is already in winget pin list, then the user should be able to remove it without --id

    this wouldn't be a problem if winget pin remove -? would say that --id can do that

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Command-PinIssue-Feature

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions