microsoft / microsoft/winget-cli

`winget install` errors with `The package is pinned and cannot be upgraded`

Open
#5,297 6 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Brief description of your issue

I want to install a specific version of Microsoft.DotNet.SDK.8 because a project requires it.

I've pinned Microsoft.DotNet.SDK.8 so WinGet does not upgrade versions automatically.

Steps to reproduce
  • PowerShell v7.5.0 x64 with -NoProfile
  • WinGet v1.10.340
PowerShell 7.5.0

PS C:\Users\olavb> winget list Microsoft.DotNet.SDK.8

Name                             Id                     Version Available Source
--------------------------------------------------------------------------------
Microsoft .NET SDK 8.0.307 (x64) Microsoft.DotNet.SDK.8 8.0.307 8.0.407   winget
Microsoft .NET SDK 8.0.407 (x64) Microsoft.DotNet.SDK.8 8.0.407           winget

PS C:\Users\olavb> winget pin list

Name                             Id                        Version             Source Pin type
----------------------------------------------------------------------------------------------
Discord                          Discord.Discord           1.0.9017            winget Pinning
Microsoft Edge                   Microsoft.Edge            134.0.3124.66       winget Pinning
Google Chrome                    Google.Chrome                                 winget Pinning
Dev Home (Preview)               Microsoft.DevHome         0.2001.758.0        winget Pinning
NTLite                           Nlitesoft.NTLite          2024.3.9819.0       winget Pinning
Google Chrome                    Google.Chrome.EXE         134.0.6998.89       winget Pinning
App Installer                    Microsoft.AppInstaller    1.25.340.0          winget Pinning
Microsoft OneDrive               Microsoft.OneDrive        25.020.0202.0001    winget Pinning
Microsoft .NET SDK 8.0.307 (x64) Microsoft.DotNet.SDK.8    8.0.307             winget Pinning
Signal 7.45.1                    OpenWhisperSystems.Signal 7.45.1              winget Pinning
Microsoft Teams                  Microsoft.Teams           25007.607.3371.8436 winget Pinning

PS C:\Users\olavb> winget install --silent --id Microsoft.DotNet.SDK.8 --architecture x64 --version 8.0.406

Found an existing package already installed. Trying to upgrade the installed package...
The package is pinned and cannot be upgraded. Use the 'winget pin' command to view and edit pins. Some pin types can be bypassed with the --include-pinned argument.

PS C:\Users\olavb> winget --version

v1.10.340

PS C:\Users\olavb> winget --info

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

Windows: Windows.Desktop v10.0.26100.3476
System Architecture: X64
Package: Microsoft.DesktopAppInstaller v1.25.340.0

Winget Directories
-----------------------------------------------------------------------------------------------------------------------
Logs                               %LOCALAPPDATA%\Packages\Microsoft.DesktopAppInstaller_8wekyb3d8bbwe\LocalState\Diag…
User Settings                      %LOCALAPPDATA%\Packages\Microsoft.DesktopAppInstaller_8wekyb3d8bbwe\LocalState\sett…
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
Configuration Modules              %LOCALAPPDATA%\Microsoft\WinGet\Configuration\Modules

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                        Disabled
BypassCertificatePinningForMicrosoftStore Disabled
InstallerHashOverride                     Disabled
LocalArchiveMalwareScanOverride           Disabled
ProxyCommandLineOptions                   Disabled
DefaultProxy                              Disabled
PS C:\Users\olavb>
Expected behavior

Should install v8.0.406.

Actual behavior

Errors saying package is pinned

Logs
2025-03-13 10:31:05.731 [CORE] WinGet, version [1.10.340], activity [{81AB289A-06E2-4E8E-A055-8D46BE0B9760}]
2025-03-13 10:31:05.732 [CORE] OS: Windows.Desktop v10.0.26100.3476
2025-03-13 10:31:05.732 [CORE] Command line Args: "C:\Users\olavb\AppData\Local\Microsoft\WindowsApps\winget.exe" install --silent --id Microsoft.DotNet.SDK.8 --architecture x64 --version 8.0.406
2025-03-13 10:31:05.732 [CORE] Package: Microsoft.DesktopAppInstaller v1.25.340.0
2025-03-13 10:31:05.732 [CORE] IsCOMCall:0; Caller: winget-cli
2025-03-13 10:31:05.742 [CLI ] WinGet invoked with arguments: 'install' '--silent' '--id' 'Microsoft.DotNet.SDK.8' '--architecture' 'x64' '--version' '8.0.406'
2025-03-13 10:31:05.742 [CLI ] Found subcommand: install
2025-03-13 10:31:05.742 [CLI ] Leaf command to execute: root:install
2025-03-13 10:31:05.747 [CLI ] Executing command: install
2025-03-13 10:31:05.758 [REPO] Default source requested, multiple sources available, adding all to source references.
2025-03-13 10:31:05.758 [REPO] Adding to source references msstore
2025-03-13 10:31:05.758 [CORE] Default proxy is not set
2025-03-13 10:31:05.758 [REPO] REST HTTP Client helper does not use proxy
2025-03-13 10:31:05.758 [REPO] Adding to source references winget
2025-03-13 10:31:05.758 [CLI ] Created authentication arguments. Mode: silentPreferred, Account: 
2025-03-13 10:31:05.767 [CORE] Examining extension: PFN = Microsoft.Winget.Source_8wekyb3d8bbwe, ID = IndexDB
2025-03-13 10:31:05.767 [CORE] Found matching extension.
2025-03-13 10:31:05.770 [REPO] Multiple sources available, creating aggregated source.
2025-03-13 10:31:05.771 [REPO] Adding to aggregated source: msstore
2025-03-13 10:31:05.771 [REPO] Sending http GET request to: https://storeedgefd.dsx.mp.microsoft.com/v9.0/information
2025-03-13 10:31:05.847 [REPO] Response status: 200
2025-03-13 10:31:05.847 [REPO] Authentication node not found. Assuming authentication type none.
2025-03-13 10:31:05.848 [REPO] Adding to aggregated source: winget
2025-03-13 10:31:05.853 [CORE] Examining extension: PFN = Microsoft.Winget.Source_8wekyb3d8bbwe, ID = IndexDB
2025-03-13 10:31:05.853 [CORE] Found matching extension.
2025-03-13 10:31:05.874 [REPO] Opening database for ImmutableRead at 'C:\Program Files\WindowsApps\Microsoft.Winget.Source_2025.313.309.1_neutral__8wekyb3d8bbwe\Public\index.db'
2025-03-13 10:31:05.874 [SQL ] Opening SQLite connection #1: 'C:\Program Files\WindowsApps\Microsoft.Winget.Source_2025.313.309.1_neutral__8wekyb3d8bbwe\Public\index.db' [1, 40]
2025-03-13 10:31:05.875 [REPO] Opened SQLite Index with version [2.0], last write [2025-03-13 03:08:26.000]
2025-03-13 10:31:06.381 [REPO] Creating new SQLite Index with version [Latest] at ':memory:'
2025-03-13 10:31:06.382 [SQL ] Opening SQLite connection #2: ':memory:' [6, 0]
2025-03-13 10:31:06.391 [REPO] Reading MSI UpgradeCodes
2025-03-13 10:31:06.500 [REPO] Reading MSI UpgradeCodes
2025-03-13 10:31:07.038 [SQL ] Opening SQLite connection #3: ':memory:' [6, 0]
2025-03-13 10:31:07.275 [REPO] Opening database for ReadWrite at 'C:\Users\olavb\AppData\Local\Packages\Microsoft.DesktopAppInstaller_8wekyb3d8bbwe\LocalState\StoreEdgeFD\installed.db'
2025-03-13 10:31:07.275 [SQL ] Opening SQLite connection #4: 'C:\Users\olavb\AppData\Local\Packages\Microsoft.DesktopAppInstaller_8wekyb3d8bbwe\LocalState\StoreEdgeFD\installed.db' [2, 0]
2025-03-13 10:31:07.276 [REPO] Opened SQLite Index with version [1.7], last write [2024-03-03 12:09:19.000]
2025-03-13 10:31:07.392 [REPO] Sending http GET request to: https://storeedgefd.dsx.mp.microsoft.com/v9.0/packageManifests/Microsoft.DotNet.SDK.8?Market=NO
2025-03-13 10:31:07.415 [REPO] Response status: 200
2025-03-13 10:31:07.423 [REPO] Opening database for ReadWrite at 'C:\Users\olavb\AppData\Local\Packages\Microsoft.DesktopAppInstaller_8wekyb3d8bbwe\LocalState\Microsoft.Winget.Source_8wekyb3d8bbwe\installed.db'
2025-03-13 10:31:07.423 [SQL ] Opening SQLite connection #5: 'C:\Users\olavb\AppData\Local\Packages\Microsoft.DesktopAppInstaller_8wekyb3d8bbwe\LocalState\Microsoft.Winget.Source_8wekyb3d8bbwe\installed.db' [2, 0]
2025-03-13 10:31:07.424 [REPO] Opened SQLite Index with version [1.7], last write [2025-03-13 10:25:32.000]
2025-03-13 10:31:07.759 [CLI ] Found one app. App id: Microsoft.DotNet.SDK.8 App name: Microsoft .NET SDK 8.0
2025-03-13 10:31:07.760 [CLI ] Found installed package, converting to upgrade flow
2025-03-13 10:31:07.777 [REPO] Attempting to open pinning database: C:\Users\olavb\AppData\Local\Packages\Microsoft.DesktopAppInstaller_8wekyb3d8bbwe\LocalState\pinning.db
2025-03-13 10:31:07.777 [REPO] ... opening existing pinning database
2025-03-13 10:31:07.777 [REPO] Opening database for Read at 'C:\Users\olavb\AppData\Local\Packages\Microsoft.DesktopAppInstaller_8wekyb3d8bbwe\LocalState\pinning.db'
2025-03-13 10:31:07.777 [SQL ] Opening SQLite connection #6: 'C:\Users\olavb\AppData\Local\Packages\Microsoft.DesktopAppInstaller_8wekyb3d8bbwe\LocalState\pinning.db' [1, 0]
2025-03-13 10:31:07.778 [REPO] Opened Pinning Index with version [1.0], last write [2025-02-05 17:50:23.000]
2025-03-13 10:31:07.778 [CLI ] The requested package version is unavailable because of a pin
2025-03-13 10:31:07.779 [CLI ] Terminating context: 0x8a150068 at C:\__w\1\s\external\pkg\src\AppInstallerCLICore\Workflows\WorkflowBase.cpp:4a2
Environment
See reproduce section

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

Reproduce the upgrade path with the reported winget install --version 8.0.406 command and inspect the pinning decision in the install flow, including the WorkflowBase.cpp entry shown in the log. Trace how the pinning database handles a requested version, then verify that the final behavior matches the issue's expected installation result.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
cli
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.