microsoft / PowerToys

Windows system utilities to maximize productivity
MIT License
111.13k stars 6.54k forks source link

PowerShell Microsoft.WinGet.Client module installation error #31914

Open SteinwaySons opened 7 months ago

SteinwaySons commented 7 months ago

Microsoft PowerToys version

0.70

Installation method

GitHub

Running as admin

Yes

Area(s) with issue?

Command not found

Steps to reproduce

PowerShell Microsoft.WinGet.Client module installation error I have manually installed PowerShell 7.4.1 through the PowerShell Offcial github and following the official instructions tightly there. image

And PowerToys also detected it. image

But, there is something wrong with the installation of PowerShell Microsoft.WinGet.Client module It always throw exceptions when I install the module. Here lists my steps. image image image

Then, the windows went out immediately with log of powertoys output the exception messages. The messages are saved into the attachment file named "exception.txt". exception.txt

I also tried installing winget by command in another powershell window. Unfortunally, failed. The reason is the same exceptions. image image image

What I don't understand is why are there errors? The official documentation says that powershell with v6.0+ comes with nuget module. So, why when installing winget module, powershell also prompts me to install nuget? I have no idea for it. Eagering for help.

✔️ Expected Behavior

No response

❌ Actual Behavior

No response

Other Software

No response

kilasuit commented 7 months ago

This is a really simple fix by either a) packaging the Microsoft.WinGet.Client module so that it's already available as part of the commandnotfound install process (my preference) b) downloading it if not already installed (not preferred)

kilasuit commented 7 months ago

Looking more into this I couldn't see an easy way for this other than perhaps asking the Winget team to publish that module as a nuget package too but that seems like the wrong way to do this to me Ideally I'd like to see a way in csproj files to specificy from other kinds of repository (PowerShell Gallery, npn, pip etc) if it's something that is a requirement, thought that's a long goal and I don't know where to raise that as a feature request to right now So if anyone does know where that would be best raised that would be great for the right team to have a think on that and see if it's feasible or sensible.

Also I'm aware it's a runtime dependency & is easily solved by users installing this required module themselves but IMO that's an extra unnecessary step that's prone for errors or blocks