Open o-l-a-v opened 7 months ago
Now I can't load it into pwsh.exe
v7.4.1 either. 🤔
But it works from pwsh.exe
v7.2.18:
Seems it has something to do with PSResourceGet v1.0.1 being included in PowerShell v7.4.1.
I deleted the whole %ProgramW6432%\PowerShell\7\Modules\Microsoft.PowerShell.PSResourceGet
directory, then v7.4.1 managed to Import-Module -Name 'Microsoft.PowerShell.PSResourceGet' -RequiredVersion 1.0.2
.
It also works as expected if adding a version directory to the v7.4.1 included PSResourceGet. So was originally:
%ProgramW6432%\PowerShell\7\Modules\Microsoft.PowerShell.PSResourceGet\<content>
Became:
%ProgramW6432%\PowerShell\7\Modules\Microsoft.PowerShell.PSResourceGet\1.0.1\<content>
Additional info:
<modulename>\<version>\<content>
).<modulename>\<version>\<content>
.<modulename>\<content>
instead of <modulename>\<version>\<content>
.This might be an issue with how Import-Module
works? Related issues:
And PScriptAnalyzer might be relevant here too? Simply opening a given script in VSCode loads PSResourceGet assemblies. I think this can be a related issue:
Can you run Get-Module
after starting a new session?
@alerickson
PowerShell 7.4.1
PS C:\Users\olavb> Get-Module
ModuleType Version PreRelease Name ExportedCommands
---------- ------- ---------- ---- ----------------
Script 2.3.4 PSReadLine {Get-PSReadLineKeyHandler, Get-PSReadLineOption, …
PS C:\Users\olavb>
I could repro with another module too, so does not seem to be the issue of PSResourceGet?
@o-l-a-v Thanks for the info, we're going to send this over to PowerShell/PowerShell
The issue is about loading modules and not specific to PowerShellResourceGet. Transferring over to PowerShell/PowerShell repository.
Prerequisites
Steps to reproduce
Microsoft.PowerShell.PSResourceGet
v1.0.2.Using pwsh.exe v7.4.1
Microsoft.PowerShell.PSResourceGet' -RequiredVersion 1.0.2 -Verbose -Debug
Using VSCode
vscode-powershell
extension v2024.0.0 and PowerShell v7.4.1Import-Module -Name 'Microsoft.PowerShell.PSResourceGet' -RequiredVersion 1.0.2 -Verbose -Debug
in the PowerShell terminal inside VSCodeExpected behavior
Module should load without problems, without workarounds like having to modify PSModulePath in process context to put preferred module directory first.
Actual behavior
Error details
Environment data
Visuals
No response