-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error installing PowerShell module using PSResourceGet #3501
Labels
Issue-Bug
It either shouldn't be doing this or needs an investigation.
PowerShell
Issue related to WinGet PowerShell Module or cmdlet
Comments
microsoft-github-policy-service
bot
added
the
Needs-Triage
Issue need to be triaged
label
Aug 4, 2023
denelon
added
Issue-Bug
It either shouldn't be doing this or needs an investigation.
PowerShell
Issue related to WinGet PowerShell Module or cmdlet
and removed
Needs-Triage
Issue need to be triaged
labels
Aug 4, 2023
msftrubengu
added a commit
that referenced
this issue
Oct 24, 2023
Move to Any CPU projects Moves Microsoft.WinGet.Client.Cmdlet and Microsoft.WinGet.Client.Engine to be Any CPU platform binaries. This is in preparation of PSResourceGet (aka PowerShellGet v3) release and addresses #3501 as $env:PROCESSOR_ARCHITECTURE is not an allowed variable in a psd1. Handle server disconnection Before, we had a static PackageManager object for OOP calls. In the scenario where winget is upgraded, this object will be disconnected, and one would have to close its PowerShell 7 session and open a new one to keep using the cmdlets. This PR creates a wrapper that handles disconnections. Windows PowerShell support Correctly throw NotSupported exception for cmdlets that use winget's COM APIs. For this I had to track down all the types being loaded per command and make sure they get loaded after the constructor of each one. This resulted in some weird cases that I need to pass a string instead of an enum in the virtual methods of some base classes. Fix issue where Microsoft.Win32.Registry.dll was missing. Add Pester tests specifically for Windows PowerShell Expected Layout Microsoft.WinGet.Client\ Format.ps1xml Microsoft.WinGet.Client.psd1 net48\ Microsoft.Win32.Registry.dll Microsoft.WinGet.Client.Cmdlets.dll Microsoft.WinGet.Client.Engine.dll Microsoft.WinGet.SharedLib.dll Newtonsoft.Json.dll Octokit.dll net6.0-windows10.0.22000.0\ Microsoft.WinGet.Client.Cmdlets.dll DirectDependencies\ Microsoft.WinGet.Client.Engine.dll SharedDependencies\ Microsoft.Windows.SDK.NET.dll Microsoft.WinGet.SharedLib.dll Newtonsoft.Json.dll Octokit.dll WinRT.Runtime.dll x64\ Microsoft.Management.Deployment.dll Microsoft.Management.Deployment.winmd WindowsPackageManager.dll winrtact.dll x86\ Microsoft.Management.Deployment.dll Microsoft.Management.Deployment.winmd WindowsPackageManager.dll winrtact.dll I didn't add the native binaries in the Windows PowerShell because they will never be loaded. Additional changes: Remove unnecessary AnyCpu build in AppInstallerCLI.sln Fully remove Microsoft.WinGet.Client tests from AppInstallerCLIE2ETests in favor of Pester tests. Improve Initialize-LocalWinGetModules.ps1 for local development. You can now specify which module to initialize.
JohnMcPMS
pushed a commit
to JohnMcPMS/winget-cli
that referenced
this issue
Nov 8, 2023
Move to Any CPU projects Moves Microsoft.WinGet.Client.Cmdlet and Microsoft.WinGet.Client.Engine to be Any CPU platform binaries. This is in preparation of PSResourceGet (aka PowerShellGet v3) release and addresses microsoft#3501 as $env:PROCESSOR_ARCHITECTURE is not an allowed variable in a psd1. Handle server disconnection Before, we had a static PackageManager object for OOP calls. In the scenario where winget is upgraded, this object will be disconnected, and one would have to close its PowerShell 7 session and open a new one to keep using the cmdlets. This PR creates a wrapper that handles disconnections. Windows PowerShell support Correctly throw NotSupported exception for cmdlets that use winget's COM APIs. For this I had to track down all the types being loaded per command and make sure they get loaded after the constructor of each one. This resulted in some weird cases that I need to pass a string instead of an enum in the virtual methods of some base classes. Fix issue where Microsoft.Win32.Registry.dll was missing. Add Pester tests specifically for Windows PowerShell Expected Layout Microsoft.WinGet.Client\ Format.ps1xml Microsoft.WinGet.Client.psd1 net48\ Microsoft.Win32.Registry.dll Microsoft.WinGet.Client.Cmdlets.dll Microsoft.WinGet.Client.Engine.dll Microsoft.WinGet.SharedLib.dll Newtonsoft.Json.dll Octokit.dll net6.0-windows10.0.22000.0\ Microsoft.WinGet.Client.Cmdlets.dll DirectDependencies\ Microsoft.WinGet.Client.Engine.dll SharedDependencies\ Microsoft.Windows.SDK.NET.dll Microsoft.WinGet.SharedLib.dll Newtonsoft.Json.dll Octokit.dll WinRT.Runtime.dll x64\ Microsoft.Management.Deployment.dll Microsoft.Management.Deployment.winmd WindowsPackageManager.dll winrtact.dll x86\ Microsoft.Management.Deployment.dll Microsoft.Management.Deployment.winmd WindowsPackageManager.dll winrtact.dll I didn't add the native binaries in the Windows PowerShell because they will never be loaded. Additional changes: Remove unnecessary AnyCpu build in AppInstallerCLI.sln Fully remove Microsoft.WinGet.Client tests from AppInstallerCLIE2ETests in favor of Pester tests. Improve Initialize-LocalWinGetModules.ps1 for local development. You can now specify which module to initialize.
Seem this can be closed as I can't replicate this @denelon |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
Issue-Bug
It either shouldn't be doing this or needs an investigation.
PowerShell
Issue related to WinGet PowerShell Module or cmdlet
Brief description of your issue
Error occurs when installing the module using install-psresource.
Steps to reproduce
install-psresource Microsoft.WinGet.Client -TrustRepository
Expected behavior
Install module without error (as is the case for PowerShellGet/Install-Module).
Actual behavior
Install-PSResource: At line:69 char:21
A variable that cannot be referenced in restricted language mode or a Data section is being referenced. Variables that can be referenced include the following: $PSCulture, $PSUICulture, $true, $false, $null, $PSEdition, $PSScriptRoot.
Environment
The text was updated successfully, but these errors were encountered: