Skip to content

Update-ModuleManifest corrupts PrivateData in module manifest #307

Open
@sdwheeler

Description

@sdwheeler

This bug by @jformacek is copied from MicrosoftDocs/PowerShell-Docs#6767

Usage of this command on existing module manifest breaks it's content. I wanted to use this command inside build pipeline to update ModuleVersion attribute, but found at least 2 things that got broken on my manifest module:

  • RequiredAssembles attribute: I have something like below in my manifest file, and Update-ModuleManifest removes this attribute completely
RequiredAssemblies = if($PSEdition -eq 'Desktop') {@('lib\net45\someAssembly.dll')} else {$null}
  • PrivateData attribute: I have added additional content as hashtable Messages to module's PrivateData as addtional hashtable aside from PSData as shown below, however, Update-ModuleManifest changes the Messages hashtable to Messages = 'System.Collections.Hashtable', which breaks the logic of module
PrivateData = @{
    Messages = @{
        NotInitialized = 'Call Initialize-Module before running other cmdlets.'
    }
    PSData = @{
    # ... standard content
    }

Would be great to update the command so as it does not change the attributes that are not passed from command line, or at least document here what gets changed/reset when command is run, so as users are not surprised after running it.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions