Powershell: Module manifest .psd1 file on linux/mac doesn't support ProcessorArchitecture='AMD64' or 'x86'

Created on 30 Mar 2018  路  8Comments  路  Source: PowerShell/PowerShell

Steps to reproduce

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

Environment data

> $PSVersionTable

Issue-Bug Resolution-Fixed WG-Engine

All 8 comments

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

  1. 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.
  2. Create a .psd1 manifest for that module
  3. Specify the output assembly file in NestedModules in the .psd1
  4. Specify a ProcessorArchitecture of Amd64 in the .psd1
  5. 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()

Will this be addressed for the final release of Powershell Core 7?
It is still an issue in Preview 4.

Again:
Will this be addressed for the final release of Powershell Core 7?
It is still an issue in RC1.

I hope it was fixed in #11046 but we need to do manual check.

:tada:This issue was addressed in #11046, which has now been successfully released as v7.0.0-rc.2.:tada:

Handy links:

Thanks! Works now in Powershell 7 RC2!

Was this page helpful?
0 / 5 - 0 ratings