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.84k stars 1.42k forks source link

The Microsoft Store source is added even if the Microsoft Store isn't available. #1558

Open jedieaston opened 2 years ago

jedieaston commented 2 years ago

Brief description of your issue

If you're on a version of Windows that doesn't have the Microsoft Store (LTSC, Server, the weird build Sandbox runs), winget adds the Microsoft Store source even though you can't use it since you can't sign in.

Steps to reproduce

  1. Install winget on Windows Sandbox (or real LTSC).
  2. Run winget install solitaire.
  3. Note that it doesn't work since you aren't signed in.
  4. Try to go sign in, and remember that you don't have the Microsoft Store so you can't do that.

    Expected behavior

Either the Microsoft Store source won't be added at all so the searches make more sense, or it will do the install without auth (as that's the same behavior that the Microsoft Store app has for free apps).

Actual behavior

image

Environment

[winget --info]

Windows: Windows.Desktop v10.0.22000.194
Package: Microsoft.DesktopAppInstaller v1.16.12653.0

Any other software?
KevinLaMS commented 2 years ago

Thanks for the report. I believe this is related to the user not being logged on to the store. Can you log into the store and retry? I suspect this will address the issue.

jedieaston commented 2 years ago

I can't log into the store because the store isn't installed on LTSC builds (or on Server, or in the Sandbox)[^1]. Therefore, I think the expected behavior here would be that the msstore source isn't available on systems that don't have the Microsoft Store installed.

[^1]: explanation here, specifically "Features from Windows 10 that could be updated with new functionality, including Cortana, Edge, and all in-box Universal Windows apps, are also not included.". I can still install winget manually (or use the in-box App Installer eventually), but in that case the Microsoft Store still isn't available.

denelon commented 2 years ago

It looks like we might need to expand on the scenario for purchased apps. We may need to add some kind of authentication method for the Windows Package Manager if/when the Microsoft Store isn't present.

KevinLaMS commented 2 years ago

@jedieaston I need a head slap emoji. :) Thanks for clarifying.

JohnMcPMS commented 2 years ago

Due to architectural reasons, the msstore source is a combination of different catalogs internally. So there are some packages that will be able to install in your scenarios. I think the right answer is not to remove the source completely, but rather detect it and limit the available packages.

Even better if we can get anonymous installs to work where appropriate, but there may be legal hurdles there that we are not aware of. Additionally, I'm not sure if the OS components are even present in these cases.

denelon commented 2 years ago

We're working on enabling the anonymous scenario. Most free packages rated "e" for everyone should not require MSA authentication in the Microsoft Store source.

denelon commented 2 years ago

@jedieaston

Does this Issue look like it's resolved in your opinion? Since the bug has been fixed for anonymous install this might be resolved. Let me know what you think.

jedieaston commented 2 years ago

The issue was that the Microsoft Store source exists even if the Microsoft Store itself isn't installed, and therefore some apps can't be installed (regardless of authentication being necessary). In Windows Sandbox, where the Microsoft Store isn't available, the store source is still installed by default in the latest preview but doesn't work correctly since there isn't a store:

PS C:\Users\WDAGUtilityAccount\Desktop\Dev> winget install iTunes --source msstore
The `msstore` source requires that you view the following agreements before using.
Terms of Transaction: https://aka.ms/microsoft-store-terms-of-transaction
The source requires the current machine's 2-letter geographic region to be sent to the backend service to function properly (ex. "US").

Do you agree to all the source agreements terms?
[Y] Yes  [N] No: y
Found iTunes [9PB2MZ1ZMB1S] Version Unknown
# snip the long description
The publisher requires that you view the above information and accept the agreements before installing.
Do you agree to the terms?
[Y] Yes  [N] No: y
Verifying/Requesting package acquisition...
Verifying/Requesting package acquisition success
Starting package install...
Failed to install or update Microsoft Store package. Error code: 0x80070422
PS C:\Users\WDAGUtilityAccount\Desktop\Dev> winget install -s msstore "Visual Studio Code" # a Win32 app from the Microsoft Store
Found Visual Studio Code [XP9KHM4BK9FZ7Q] Version Unknown
# snip the long description
The publisher requires that you view the above information and accept the agreements before installing.
Do you agree to the terms?
[Y] Yes  [N] No: y
Downloading https://github.com/microsoft/vscode-winsta11er/releases/download/v0.0.5/vscode-winsta11er-x64.exe
  ██████████████████████████████  6.34 MB / 6.34 MB
Successfully verified installer hash
Starting package install...
Successfully installed

@JohnMcPMS is right, there are packages that will install (Win32 apps, specifically, since they act like other winget apps). I think that winget should be able to detect which apps are installable and hide the others from searches to prevent confusion. It's up to you if that's a different bug or not, since strictly speaking, the Microsoft Store source works a bit more than it did (it's still confusing though).

denelon commented 2 years ago

OK, I'll keep this open, and start some internal discussions on what kind of options might get the right desired behavior.