You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Module manifest .psd1 file on linux/mac doesn't support ProcessorArchitecture='AMD64' or 'x86' #6533
On Linux/Mac:
Open any module .psd1 file and update/ add the following line:
ProcessorArchitecture = 'Amd64'
OR
ProcessorArchitecture ='x86'
Please note: ProcessorArchitecture='None' seems to work.
Expected behavior
The module should be discoverable using Get-Module -ListAvailable and Import-Module should work fine as it does on Windows.
Actual behavior
The module is not listed using Get-Module and Import-Module fails with this error:
Import-Module : Unable to load DLL 'api-ms-win-core-sysinfo-l1-1-0.dll': The specified module or one of its dependencies could not be found.
(Exception from HRESULT: 0x8007007E)
At line:1 char:1
+ Import-Module Standard
+ ~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Import-Module], DllNotFoundException
+ FullyQualifiedErrorId : System.DllNotFoundException,Microsoft.PowerShell.Commands.ImportModuleCommand
Just ran across this myself. Was going to file a separate issue, but will throw my comments in here instead. I'm not sure if this is specific to compiled modules or not, but that's how I came across mine.
Steps to reproduce
Create a cmdlet in C# targetting .NET Standard (I used 2.0, not sure the version matters) and compile it via dotnet publish --self-contained.
Create a .psd1 manifest for that module
Specify the output assembly file in NestedModules in the .psd1
Specify a ProcessorArchitecture of Amd64 in the .psd1
Attempt to import the module
Expected behavior
The module is imported properly on non-Windows systems
Actual behavior
On Windows systems, the module imports properly.
On non-Windows systems, the module import will fail with the following error:
ipmo : Unable to load shared library 'api-ms-win-core-sysinfo-l1-1-0.dll' or one of its dependencies. In order to help diagnose loading problems, consider setting the LD_DEBUG environment variable: libapi-ms-win-core-sysinfo-l1-1-0.dll: cannot open shared object file: No such file or directory
At line:1 char:16
+ cd /powerkube; ipmo ./output/PowerKube.psd1
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Import-Module], DllNotFoundException
+ FullyQualifiedErrorId : System.DllNotFoundException,Microsoft.PowerShell.Commands.ImportModuleCommand
Environment data
Linux
Name Value
---- -----
PSVersion 6.1.1
PSEdition Core
GitCommitId 6.1.1
OS Linux 4.9.125-linuxkit #1 SMP Fri Sep 7 08:20:28 UTC 2018
Platform Unix
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
Windows
Name Value
---- -----
PSVersion 6.1.1
PSEdition Core
GitCommitId 6.1.1
OS Microsoft Windows 10.0.17134
Platform Win32NT
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
Stack Trace
at System.Management.Automation.PsUtils.NativeMethods.GetSystemInfo(SYSTEM_INFO& lpSystemInfo)
at System.Management.Automation.PsUtils.GetProcessorArchitecture(Boolean& isRunningOnArm)
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.LoadModuleManifest(ExternalScriptInfo scriptInfo, ManifestProcessingFlags manifestProcessingFlags, Version minimumVersion, Version maximumVersion, Version requiredVersion, Nullable`1 requiredModuleGuid, ImportModuleOptions& options)
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.LoadModule(String fileName, String moduleBase, String prefix, SessionState ss, ImportModuleOptions& options, ManifestProcessingFlags manifestProcessingFlags, Boolean& found)
at Microsoft.PowerShell.Commands.ImportModuleCommand.ImportModule_LocallyViaName(ImportModuleOptions importModuleOptions, String name)
at Microsoft.PowerShell.Commands.ImportModuleCommand.ProcessRecord()
at System.Management.Automation.Cmdlet.DoProcessRecord()
at System.Management.Automation.CommandProcessor.ProcessRecord()
Activity
DWSR commentedon Dec 12, 2018
Just ran across this myself. Was going to file a separate issue, but will throw my comments in here instead. I'm not sure if this is specific to compiled modules or not, but that's how I came across mine.
Steps to reproduce
dotnet publish --self-contained..psd1manifest for that moduleNestedModulesin the.psd1ProcessorArchitectureofAmd64in the.psd1Expected behavior
Actual behavior
Environment data
Linux
Windows
Stack Trace
Get Tests Working in CI
markekraus commentedon Dec 16, 2018
I looked at this per Brandon McNama (@DWSR) request.
Upon importing a module GetProcessorArchitechture() is called here
PowerShell/src/System.Management.Automation/engine/Modules/ModuleCmdletBase.cs
Line 1852 in 2b4199a
which is defined here
PowerShell/src/System.Management.Automation/utils/PsUtils.cs
Line 141 in 2b4199a
Which then calls GetStsyemInfo which is defined here
PowerShell/src/System.Management.Automation/utils/PsUtils.cs
Lines 265 to 266 in 2b4199a
which is PINvoking the
api-ms-win-core-sysinfo-l1-1-0.dllas defined here:PowerShell/src/System.Management.Automation/utils/PInvokeDllNames.cs
Line 58 in 2b4199a
This is why on non-windows
Unable to load shared library 'api-ms-win-core-sysinfo-l1-1-0.dll'happensZonderP commentedon Oct 22, 2019
Will this be addressed for the final release of Powershell Core 7?
It is still an issue in Preview 4.
ZonderP commentedon Jan 9, 2020
Again:
Will this be addressed for the final release of Powershell Core 7?
It is still an issue in RC1.
SteveL-MSFT commentedon Jan 9, 2020
I believe #11046 will resolve this
iSazonov commentedon Jan 14, 2020
I hope it was fixed in #11046 but we need to do manual check.
ZonderP commentedon Jan 17, 2020
Thanks! Works now in Powershell 7 RC2!