New-ModuleManifest generates ExternalModuleDependencies settings that are incompatible with Publish-Module
The following command:
New-ModuleManifest -Path .\Test.psd1 -RequiredModules @('AWSPowerShell.NetCore') -ExternalModuleDependencies @('AWSPowerShell.NetCore') -PassThru
results in the following manifest being generated (irrelevant data excluded):
...
RequiredModules = @('AWSPowerShell.NetCore')
...
PrivateData = @{
PSData = @{
...
# External dependent modules of this module
ExternalModuleDependencies = 'AWSPowerShell.NetCore'
} # End of PSData hashtable
} # End of PrivateData hashtable
...
Note that ExternalModuleDependencies is not a String array as defined by the documentation. This output appears to be incompatible with Publish-Module as I receive the following error using this .psd1 file:
WARNING: PowerShellGet cannot resolve the module dependency 'AWSPowerShell.NetCore' of the module 'Test' on the repository 'local'. Verify that the dependent module 'AWSPowerShell.NetCore' is available in the repository 'local'. If this dependent module 'AWSPowerShell.NetCore' is managed externally, add it to the ExternalModuleDependencies entry in the PSData section of the module manifest.
Adding a dummy entry to the ExternalModuleDependencies string array:
New-ModuleManifest -Path .\Test.psd1 -RequiredModules @('AWSPowerShell.NetCore') -ExternalModuleDependencies @('AWSPowerShell.NetCore', 'dummy') -PassThru
Generates the following structure which allows publishing to succeed:
...
RequiredModules = @('AWSPowerShell.NetCore')
...
PrivateData = @{
PSData = @{
...
# External dependent modules of this module
ExternalModuleDependencies = 'AWSPowerShell.NetCore', 'dummy'
} # End of PSData hashtable
} # End of PrivateData hashtable
...
Similarly, manually setting ExternalModuleDependencies to @(AWSPowerShell.NetCore) by editing the generated .psd1 file allows publishing to succeed.
The same structure is generated using the dotnet/sdk:5.0 docker container (PowerShell 7.1.3)
$PSVersionTable:
Name Value
---- -----
PSVersion 7.1.3
PSEdition Core
GitCommitId 7.1.3
OS Linux 4.19.128-microsoft-standard PowerShell/PowerShellGet#1 SMP Tue Jun 23 12:58:10 UTC 2020
Platform Unix
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
and the dotnet/sdk:3.1 docker container (PowerShell 7.0.6)
$PSVersionTable:
Name Value
---- -----
PSVersion 7.0.6
PSEdition Core
GitCommitId 7.0.6
OS Linux 4.19.128-microsoft-standard PowerShell/PowerShellGet#1 SMP Tue Jun 23 12:58:10 UTC 2020
Platform Unix
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
Thanks @testworksau we will try to incorporate this fix/test this scenario as we complete new Publish functionality for v3
I came to complain about this not working at all, but I guess maybe I'll try explicitly wrapping it in an array? This needs to be backwards compatible...
This issue has not had any activity in 6 months, if this is a bug please try to reproduce on the latest version of PowerShell and reopen a new issue and reference this issue if this is still a blocker for you.
This issue has been marked as "No Activity" as there has been no activity for 6 months. It has been closed for housekeeping purposes.