microsoft / winget-cli

WinGet is the Windows Package Manager. This project includes a CLI (Command Line Interface), PowerShell modules, and a COM (Component Object Model) API (Application Programming Interface).
https://learn.microsoft.com/windows/package-manager/
MIT License
22.97k stars 1.43k forks source link

Unable to Add Pin; Trying to upgrade the installed package... #4249

Closed dgulik closed 6 months ago

dgulik commented 6 months ago

Brief description of your issue

Unable to pin a package. The package was previously pinned. After having some other issues with winget, I reset it and then ran upgrade all and it started to upgrade a previously pinned package, and I closed the CLI while this upgrade was in progress. Now I am unable to pin this package. Please, refer to screenshot. Screenshot 2024-03-06 201649 image

Steps to reproduce

winget add pin OBSProject.OBSStudio winget add pin WavesAudio.WavesCentral

both of these were previously pinned.

Expected behavior

packages to be pinned so I can run upgrade --all

Actual behavior

packages are not pinning due to error; "Trying to upgrade the installed package..."

Environment

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

Windows: Windows.Desktop v10.0.22631.3235
System Architecture: X64
Package: Microsoft.DesktopAppInstaller v1.22.10582.0
Trenly commented 6 months ago

@dgulik - Have you tried winget pin add instead of winget add pin? winget add is an alias for winget install

PS D:\Git\winget-pkgs> winget install -?
Windows Package Manager v1.7.10582
Copyright (c) Microsoft Corporation. All rights reserved.

Installs the selected package, either found by searching a configured source or directly from a manifest. By default, the query must case-insensitively match the id, name, or moniker of the package. Other fields can be used by passing their appropriate option. By default, install command will check package installed status and try to perform an upgrade if applicable. Override with --force to perform a direct install.

usage: winget install [[-q] <query>...] [<options>]

The following command aliases are available:
  add

https://learn.microsoft.com/en-us/windows/package-manager/winget/pinning#usage

PS D:\Git\winget-pkgs> winget pin -?
Windows Package Manager v1.7.10582
Copyright (c) Microsoft Corporation. All rights reserved.

Manage package pins with the sub-commands. A pin can limit the Windows Package Manager from upgrading a package to specific ranges of versions, or it can prevent it from upgrading the package altogether. A pinned package may still upgrade on its own and be upgraded from outside the Windows Package Manager.

usage: winget pin [<command>] [<options>]

The following sub-commands are available:
  add     Add a new pin
  remove  Remove a package pin
  list    List current pins
  reset   Reset pins
dgulik commented 6 months ago

Oh well, my mistake. I was using the wrong command. winget pin add produces the correct result.

On Wed, Mar 6, 2024 at 9:06 PM Kaleb Luedtke @.***> wrote:

@dgulik https://github.com/dgulik - Have you tried winget pin add instead of winget add pin?

https://learn.microsoft.com/en-us/windows/package-manager/winget/pinning#usage

— Reply to this email directly, view it on GitHub https://github.com/microsoft/winget-cli/issues/4249#issuecomment-1982252634, or unsubscribe https://github.com/notifications/unsubscribe-auth/ALU3DEKV2BDYDCMPI74MFJTYW7KSPAVCNFSM6AAAAABEKFU2HOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSOBSGI2TENRTGQ . You are receiving this because you were mentioned.Message ID: @.***>