microsoft / go-sqlcmd

The new sqlcmd, CLI for SQL Server and Azure SQL (winget install sqlcmd / sqlcmd create mssql / sqlcmd open ads)
https://learn.microsoft.com/sql/tools/sqlcmd/go-sqlcmd-utility
MIT License
334 stars 58 forks source link

Unable to upgrade with winget #315

Closed grrlgeek closed 1 year ago

grrlgeek commented 1 year ago

:>winget install sqlcmd -v 0.15.2 Found Sqlcmd Tools [Microsoft.Sqlcmd] Version 0.15.2 This application is licensed to you by its owner. Microsoft is not responsible for, nor does it grant any licenses to, third-party packages. Downloading https://github.com/microsoft/go-sqlcmd/releases/download/v0.15.2/sqlcmd_0.15.2-1.msi   ██████████████████████████████  5.51 MB / 5.51 MB Successfully verified installer hash Starting package install... Successfully installed

c:>sqlcmd --version sqlcmd: v0.15.2

c:>winget upgrade sqlcmd No applicable upgrade found.

c:>winget upgrade --name sqlcmd No installed package found matching input criteria.

stuartpa commented 1 year ago

I'm investigating this. winget uninstall / winget install is a workaround in the meantime

stuartpa commented 1 year ago

After reading the winget docs:

https://github.com/microsoft/winget-cli/blob/master/doc/windows/package-manager/winget/upgrade.md

It's not obvious to me yet why this doesn't work:

C:\>winget list sqlcmd
Name         Id               Version Available Source
------------------------------------------------------
Sqlcmd Tools Microsoft.Sqlcmd 0.15.3  0.15.4    winget

C:\>winget upgrade Microsoft.Sqlcmd
No applicable upgrade found.

C:\>
grrlgeek commented 1 year ago

I wonder if it is case sensitive. I tried with another application today.

C:\Users\jeschult>winget upgrade
Name                                                 Id                              Version       Available     Source
-----------------------------------------------------------------------------------------------------------------------
Git                                                  Git.Git                         2.39.0.2      2.40.0        winget
Microsoft Teams                                      Microsoft.Teams                 1.6.00.6704   1.6.00.6754   winget
Python 3.10.6 (64-bit)                               Python.Python.3.10              3.10.6        3.10.10       winget
Microsoft Visual C++ 2015-2019 Redistributable (x64… Microsoft.VCRedist.2015+.x64    14.29.30139.0 14.34.31938.0 winget
DisplayLink Graphics                                 DisplayLink.GraphicsDriver      10.2.7042.0   11.0.2412.0   winget
Teams Machine-Wide Installer                         Microsoft.Teams                 1.5.0.8070    1.6.00.6754   winget
Logi Options+                                        Logitech.OptionsPlus            1.32.363144   1.38.7153     winget
Microsoft Azure Storage Explorer version 1.25.1      Microsoft.Azure.StorageExplorer 1.25.1        1.28.1        winget
Microsoft Visual C++ 2015-2019 Redistributable (x86… Microsoft.VCRedist.2015+.x86    14.29.30139.0 14.34.31938.0 winget
Microsoft Azure CLI                                  Microsoft.AzureCLI              2.41.0        2.47.0        winget
10 upgrades available.

C:\Users\jeschult>winget upgrade --name "Microsoft Azure CLI"
Found Microsoft Azure CLI [Microsoft.AzureCLI] Version 2.47.0

I will try the upgrade again with our next release.

stuartpa commented 1 year ago

Making progress on this, running:

winget upgrade sqlcmd --verbose-logs

Run --info to get the location of the verbose logs

winget --info

Look at the end of the large 5MB file it just produced:

2023-05-09 23:54:03.924 [REPO] Downloading manifest 2023-05-09 23:54:03.924 [CORE] WinINet downloading from url: https://cdn.winget.microsoft.com/cache/manifests/m/Microsoft/Sqlcmd/1.0.0/0838-Microsoft.Sqlcmd.yaml 2023-05-09 23:54:03.929 [CORE] Download request status success. 2023-05-09 23:54:03.929 [CORE] Download size: 1679 2023-05-09 23:54:03.929 [CORE] Download hash: 0689c9171eeaf2d4b194b940dd4cab265903df466ba1b51ed732a71ea38bc91f 2023-05-09 23:54:03.929 [CORE] Download completed. 2023-05-09 23:54:03.930 [REPO] Manifest contents: Copyright: Copyright (c) Microsoft Corporation InstallerLocale: en-US InstallerSwitches: Silent: /qn SilentWithProgress: /qb InstallerType: wix Installers:

2023-05-09 23:54:03.931 [CLI ] Starting installer selection. 2023-05-09 23:54:03.931 [CLI ] Installer [X64,wix,User,en-US] not applicable: Installer scope does not match currently installed scope: User != Machine 2023-05-09 23:54:03.941 [CLI ] Terminating context: 0x8a15002b at D:\a_work\1\s\external\pkg\src\AppInstallerCLICore\Workflows\UpdateFlow.cpp:87

So the issue is "Installer scope does not match currently installed scope: User != Machine".

Looks like this Winget issue describes the problem, I'm investigating now:

https://github.com/microsoft/winget-cli/issues/3011

stuartpa commented 1 year ago

Ok, I've worked out the issue, in the winget manifest I have "scope: user", this should be "scope: machine". I was moving back and forth between user and machine installers when working on the path ordering issues. I must have missed this setting when moving to machine, which is what we have finalized on (to ensure go-sqlcmd appears before the odbc sqlcmd in path ordering when both on the same machine)

When we do the next . release, I'll fix the manifest

dlevy-msft commented 1 year ago

This is fixed now.