Skip to content

Warning missing that usage of this command corrupts manifest file #6767

Description

Hello,
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.

Thank you,
Jiri


⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

Activity

  1. sdwheeler commented on Oct 19, 2020

    @sdwheeler
    Contributor

    Sydney Smith (@SydneyhSmith) What is the expected behavior here? We should file an issue. Which repo do you want this in?

  2. SydneyhSmith commented on Oct 19, 2020

    @SydneyhSmith
    Contributor
  3. sdwheeler commented on Oct 19, 2020

    @sdwheeler
    Contributor
  4. sdwheeler commented on Oct 19, 2020

    @sdwheeler
    Contributor

    After reviewing the source code, it appears that Update-ModuleManifest supports single values or arrays for extra data. See https://github.com/PowerShell/PowerShellGetv2/blob/f45bfe1a66df7063aa8de10fc4f147fdc23639af/src/PowerShellGet/private/functions/Get-PrivateData.ps1#L61-L79

  5. sdwheeler commented on Oct 27, 2020

    @sdwheeler
    Contributor

    I copied this issue to the PowerShellGet repo.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-powershellgetArea - PowerShellGet moduleresolution-externalStatus - closed by customer or outside resource

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions