microsoft / microsoft/winget-cli-restsource

PowerShell module does not work in PowerShell 5.1

Open
#173 1 comment 0 reactions 1 assignee View on GitHub

@RDMacLachlan is already working on this.

Since Sep 29, 2022.

Issue-Docs
Dominant language
C#
Stars
317
Forks
79
PR merge metrics
No merged PRs in 30d

Description

Brief description of your issue

The Microsoft.WinGet.Source.psd1 module will not load with PowerShell 5.1. It fails with the following error:

Add-Type : Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more
information.
At C:\src\winget-cli-restsource\Tools\PowershellModule\src\Microsoft.WinGet.Source.psm1:24 char:17
+ ...             Add-Type -Path "$PSScriptRoot\Library\HelperLib\x64\Micro ...
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Add-Type], ReflectionTypeLoadException
    + FullyQualifiedErrorId : System.Reflection.ReflectionTypeLoadException,Microsoft.PowerShell.Commands.AddTypeComma
   nd

LoaderExceptions contains the following missing dependencies:

Could not load file or assembly 'netstandard, Version=2.1.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' or
one of its dependencies. The system cannot find the file specified.
Could not load file or assembly 'netstandard, Version=2.1.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' or
one of its dependencies. The system cannot find the file specified.
Could not load file or assembly 'netstandard, Version=2.1.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' or
one of its dependencies. The system cannot find the file specified.

The README.md does not make any mention that PowerShell 5.1 is not supported and that you need a newer version of PowerShell. (It loaded for me fine in PowerShell 7, after working around #172. :))

This is not called out in the documentation as a prerequisite.

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.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.