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
23.38k stars 1.46k forks source link

Unable to install vscode and 7zip using WinGet configure #3368

Open OreoFrosting opened 1 year ago

OreoFrosting commented 1 year ago

Brief description of your issue

When I run winget configure on my yaml file, I get the message "The module for the configuration unit is available in multiple locations within the same version." I've also had trouble finding the correct resource name within given DSC modules, is there an easy way to do this that I am unaware of? I think I'm using the correct resource to get vscode and 7zip.

# yaml-language-server: $schema=https://aka.ms/configuration-dsc-schema/0.2
properties:
  resources:
    - resource: WinGetPackage
      id: vsCode
      directives:
        module: Microsoft.WinGet.DSC
        description: 'Install Microsoft Visual Studio Code'
        allowPrerelease: true
      settings:
        id: Microsoft.VisualStudioCode
        source: winget
    - resource: Microsoft.WinGet.DSC/WinGetPackage
      id: 7zip
      directives:
        description: Install 7Zip
        allowPrerelease: true
      settings:
        id: 7zip.7zip
        source: winget
  configurationVersion: 0.2.0

wingetError

Steps to reproduce

Run winget configure with my given yaml code

Expected behavior

I expected both vscode and 7zip to install as expected

Actual behavior

An error/warning is given

Environment

Windows Package Manager (Preview) v1.6.1573-preview
Windows: Windows.Desktop v10.0.19044.1348
System Architecture: X64
Package: Microsoft.DesktopAppInstaller v1.21.1573.0
dbensmith commented 1 year ago

@OreoFrosting, I have the same problem with 7-zip. I noticed that, just like in your screenshot, the parser appears to interpret id: 7zip.7zip as just 7 which causes winget search to fail on configure.

I was able to work around this problem by putting 7-zip.7-zip in quotes, like this: id: "7-zip.7-zip".

This resolved the issue with 7-zip for me. I didn't have the issue with VS Code.

I still think this should be treated as a bug.

egerlach commented 1 year ago

I had this problem as well. I had installed Microsoft.WinGet.DSC on my system already. I think it was conflicting with the vendored version that winget brings with itself. For some reason I couldn't Uninstall-Module the one in my PSModulePath, but when I deleted it things started to work.