Module should load without problems, without workarounds like having to modify PSModulePath in process context to put preferred module directory first.
PS C:\Users\olav.birkeland> Import-Module -Name 'Microsoft.PowerShell.PSResourceGet' -RequiredVersion 1.0.2 -Verbose -Debug
VERBOSE: Loading module from path 'C:\program files\powershell\7\Modules\Microsoft.PowerShell.PSResourceGet\Microsoft.PowerShell.PSResourceGet.psd1'.
VERBOSE: Loading module from path 'C:\Users\olav.birkeland\AppData\Local\Microsoft\PowerShell\Modules\Microsoft.PowerShell.PSResourceGet\1.0.2\Microsoft.PowerShell.PSResourceGet.psd1'.
VERBOSE: Loading 'FormatsToProcess' from path 'C:\Users\olav.birkeland\AppData\Local\Microsoft\PowerShell\Modules\Microsoft.PowerShell.PSResourceGet\1.0.2\PSGet.Format.ps1xml'.
VERBOSE: Loading module from path 'C:\Users\olav.birkeland\AppData\Local\Microsoft\PowerShell\Modules\Microsoft.PowerShell.PSResourceGet\1.0.2\Microsoft.PowerShell.PSResourceGet.psd1'.
VERBOSE: Loading 'FormatsToProcess' from path 'C:\Users\olav.birkeland\AppData\Local\Microsoft\PowerShell\Modules\Microsoft.PowerShell.PSResourceGet\1.0.2\PSGet.Format.ps1xml'.
VERBOSE: Populating RepositorySourceLocation property for module Microsoft.PowerShell.PSResourceGet.
VERBOSE: Loading module from path 'C:\Users\olav.birkeland\AppData\Local\Microsoft\PowerShell\Modules\Microsoft.PowerShell.PSResourceGet\1.0.2\Microsoft.PowerShell.PSResourceGet.psm1'.
VERBOSE: Exporting function 'Import-PSGetRepository'.
VERBOSE: Importing function 'Import-PSGetRepository'.
VERBOSE: Loading module from path 'C:\Users\olav.birkeland\AppData\Local\Microsoft\PowerShell\Modules\Microsoft.PowerShell.PSResourceGet\1.0.2\Microsoft.PowerShell.PSResourceGet.dll'.
Import-Module: Assembly with same name is already loaded
PS C:\Users\olav.birkeland>
Exception :
Type : System.IO.FileLoadException
Message : Assembly with same name is already loaded
TargetSite :
Name : LoadBinaryModule
DeclaringType : Microsoft.PowerShell.Commands.ModuleCmdletBase
MemberType : Method
Module : System.Management.Automation.dll
Source : System.Management.Automation
HResult : -2146232799
StackTrace :
at Microsoft.PowerShell.Commands.ModuleCmdletBase.LoadBinaryModule(PSModuleInfo parentModule, String moduleName, String fileName, Assembly assemblyToLoad, String moduleBase, SessionState ss, ImportModuleOptions options, ManifestProcessingFlags manifestProcessingFlags, String prefix, Boolean& found, String shortModuleName, Boolean disableFormatUpdates)
at Microsoft.PowerShell.Commands.ModuleCmdletBase.LoadModule(PSModuleInfo parentModule, String fileName, String moduleBase, String prefix, SessionState ss, Object privateData, ImportModuleOptions& options, ManifestProcessingFlags manifestProcessingFlags, Boolean& found, Boolean& moduleFileFound)
at Microsoft.PowerShell.Commands.ModuleCmdletBase.LoadModuleNamedInManifest(PSModuleInfo parentModule, ModuleSpecification moduleSpecification, String moduleBase, Boolean searchModulePath, String prefix, SessionState ss, ImportModuleOptions options, ManifestProcessingFlags manifestProcessingFlags, Object privateData, Boolean& found, String shortModuleName, Nullable`1 manifestLanguageMode)
at Microsoft.PowerShell.Commands.ModuleCmdletBase.LoadModuleManifest(String moduleManifestPath, ExternalScriptInfo manifestScriptInfo, Hashtable data, Hashtable localizedData, ManifestProcessingFlags manifestProcessingFlags, Version minimumVersion, Version maximumVersion, Version requiredVersion, Nullable`1 requiredModuleGuid, ImportModuleOptions& options, Boolean& containedErrors)
at Microsoft.PowerShell.Commands.ModuleCmdletBase.LoadModule(PSModuleInfo parentModule, String fileName, String moduleBase, String prefix, SessionState ss, Object privateData, ImportModuleOptions& options, ManifestProcessingFlags manifestProcessingFlags, Boolean& found, Boolean& moduleFileFound)
at Microsoft.PowerShell.Commands.ModuleCmdletBase.LoadUsingExtensions(PSModuleInfo parentModule, String moduleName, String fileBaseName, String extension, String moduleBase, String prefix, SessionState ss, ImportModuleOptions options, ManifestProcessingFlags manifestProcessingFlags, Boolean& found, Boolean& moduleFileFound)
at Microsoft.PowerShell.Commands.ModuleCmdletBase.LoadUsingMultiVersionModuleBase(String moduleBase, ManifestProcessingFlags manifestProcessingFlags, ImportModuleOptions importModuleOptions, Boolean& found)
at Microsoft.PowerShell.Commands.ModuleCmdletBase.LoadUsingModulePath(PSModuleInfo parentModule, IEnumerable`1 modulePath, String name, SessionState ss, ImportModuleOptions options, ManifestProcessingFlags manifestProcessingFlags, PSModuleInfo& module)
at Microsoft.PowerShell.Commands.ImportModuleCommand.ImportModule_LocallyViaName(ImportModuleOptions importModuleOptions, String name)
at Microsoft.PowerShell.Commands.ImportModuleCommand.ImportModule_LocallyViaName_WithTelemetry(ImportModuleOptions importModuleOptions, String name)
at Microsoft.PowerShell.Commands.ImportModuleCommand.ProcessRecord()
at System.Management.Automation.CommandProcessor.ProcessRecord()
CategoryInfo : NotSpecified: (:) [Import-Module], FileLoadException
FullyQualifiedErrorId : System.IO.FileLoadException,Microsoft.PowerShell.Commands.ImportModuleCommand
InvocationInfo :
MyCommand : Import-Module
ScriptLineNumber : 1
OffsetInLine : 1
HistoryId : 1
Line : Import-Module -Name 'Microsoft.PowerShell.PSResourceGet' -RequiredVersion 1.0.2 -Verbose -Debug
Statement : Import-Module -Name 'Microsoft.PowerShell.PSResourceGet' -RequiredVersion 1.0.2 -Verbose -Debug
PositionMessage : At line:1 char:1
+ Import-Module -Name 'Microsoft.PowerShell.PSResourceGet' -RequiredVer …
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
InvocationName : Import-Module
CommandOrigin : Internal
ScriptStackTrace : at <ScriptBlock>, <No file>: line 1
Prerequisites
Steps to reproduce
Microsoft.PowerShell.PSResourceGetv1.0.2.Using pwsh.exe v7.4.1
Microsoft.PowerShell.PSResourceGet' -RequiredVersion 1.0.2 -Verbose -DebugUsing VSCode
vscode-powershellextension v2024.0.0 and PowerShell v7.4.1Import-Module -Name 'Microsoft.PowerShell.PSResourceGet' -RequiredVersion 1.0.2 -Verbose -Debugin 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