microsoft / microsoft/winget-cli

winget configure fails with Could not load file or assembly 'Microsoft.WinGet.Client.Engine'

Open
#4,160 7 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Command-Configure 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'm trying to run a working configuration (provided by @denelon here) but it fails on my machine using the same configuration.

# yaml-language-server: $schema=https://aka.ms/configuration-dsc-schema/0.2
properties:
  resources:
    - resource: Microsoft.WinGet.DSC/WinGetPackage
      id: ohmyposh
      directives:
        description: Install Oh My Posh
        allowPrerelease: true
      settings:
        id: JanDeDobbeleer.OhMyPosh
        source: winget
  configurationVersion: 0.2.0
Steps to reproduce

Not sure, it seems to be device/environment specific.

Expected behavior

It succeeds in applying the configuration.

Actual behavior

It crashed with:

2024-02-11 16:11:28.178 [CORE] WinGet, version [1.7.3481-preview], activity [{E2EE6697-1F5F-4191-B391-FF74A7A0258C}]
2024-02-11 16:11:28.178 [CORE] OS: Windows.Desktop v10.0.22000.2538
2024-02-11 16:11:28.178 [CORE] Command line Args: "C:\Users\jan\AppData\Local\Microsoft\WindowsApps\winget.exe" configure C:\Users\jan\Documents\oh-my-posh.dsc.yaml --logs
2024-02-11 16:11:28.178 [CORE] Package: Microsoft.DesktopAppInstaller v1.22.3481.0
2024-02-11 16:11:28.178 [CORE] IsCOMCall:0; Caller: winget-cli
2024-02-11 16:11:28.181 [CLI ] WinGet invoked with arguments: 'configure' 'C:\Users\jan\Documents\oh-my-posh.dsc.yaml' '--logs'
2024-02-11 16:11:28.181 [CLI ] Found subcommand: configure
2024-02-11 16:11:28.181 [CLI ] Leaf command to execute: root:configure
2024-02-11 16:11:28.181 [CLI ] Executing command: configure
2024-02-11 16:11:33.915 [CONF] Configuration unit WinGetPackage[ohmyposh] failed with code 0x8a15c105 and error message:
Could not load file or assembly 'Microsoft.WinGet.Client.Engine, Version=1.21.0.0, Culture=neutral, PublicKeyToken=null'. Uncaught exception during type initialization. (0x80131534)
Microsoft.Management.Configuration.Processor.Exceptions.InvokeDscResourceException: Failed when calling `Test` for resource: WinGetPackage [Microsoft.WinGet.DSC] Message: 'Could not load file or assembly 'Microsoft.WinGet.Client.Engine, Version=1.21.0.0, Culture=neutral, PublicKeyToken=null'. Uncaught exception during type initialization. (0x80131534)
'
   at Microsoft.Management.Configuration.Processor.DscModule.DscModuleV2.InvokeTestResource(PowerShell pwsh, ValueSet settings, String name, ModuleSpecification moduleSpecification)
   at Microsoft.Management.Configuration.Processor.Runspaces.HostedEnvironment.InvokeTestResource(ValueSet settings, String name, ModuleSpecification moduleSpecification)
   at Microsoft.Management.Configuration.Processor.Unit.ConfigurationUnitProcessor.TestSettings()
2024-02-11 16:11:33.915 [CLI ] Terminating context: 0x8a15c005 at C:\__w\1\s\external\pkg\src\AppInstallerCLICore\Workflows\ConfigurationFlow.cpp:3f9
Environment
Windows Package Manager (Preview) v1.7.3481-preview
Copyright (c) Microsoft Corporation. All rights reserved.

Windows: Windows.Desktop v10.0.22000.2538
System Architecture: Arm64
Package: Microsoft.DesktopAppInstaller v1.22.3481.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

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

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

Start with the supplied winget configure command, DSC YAML, and diagnostic log, focusing on the Microsoft.WinGet.DSC/WinGetPackage Test failure and the missing Microsoft.WinGet.Client.Engine assembly. Compare the environment details with a working configuration or reproduction; done means the same configuration applies successfully without the assembly-loading exception.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, powershell
Domain
cli, operating-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.