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.96k stars 1.43k forks source link

Better message around prerelease modules #4024

Open denelon opened 8 months ago

denelon commented 8 months ago

Description of the new feature / enhancement

When I have a configuration and it is attempting to use a DSC Resource in a prerelease PowerShell module, the configuration fails if I have "prerelease: false". When the configuration is being evaluated, it should help in the case where a prerelease module is available but a stable module is not.

Related to/Inspired by:

Proposed technical implementation details

No response

JohnMcPMS commented 1 month ago

winget configure validate does this currently (using configuration from linked issue):

> winget configure validate E:\Temp\validate-config.yaml
Apply :: WinGetPackage [chrome]
  The configuration unit is only available as a prerelease, but it is not marked that way in the configuration. Add `allowPrerelease: true` to the `directives`.

Which additional scenarios should inform the user?

  1. winget configure file.yaml
  2. winget configure show file.yaml
  3. Get-WinGetConfiguration file.yaml
  4. Get-WinGetConfiguration file.yaml | Invoke-WinGetConfiguration
  5. Get-WinGetConfiguration file.yaml | Confirm-WinGetConfiguration

The code that does this specific check occurs outside of the core configuration component. If we wanted it to be universally available, I think the best solution would be to add new APIs to the core component and shift the current code into the processor. This would be a somewhat larger task that would really only help Confirm-WinGetConfiguration directly. Even more would be required if we wanted to enable it to work generically from applying.

Improvements to the error messaging around "we couldn't find the resource" could be made more easily to just the winget commands using the existing code and messaging.

denelon commented 1 month ago

I think it should be in each scenario. This is a "help the user" fall into the pit of success. It's going to be even more complex for enterprise customers with source and configuration restrictions to understand and help their users.

denelon commented 1 month ago

In order to scope this down to get an initial improvement out, feel free to create another "smaller" issue for the CLI side, and we can work on the larger scoped improvements in the future.