PowerShell / PowerShell/PSResourceGet
Update-ModuleManifest corrupts PrivateData in module manifest
Nobody has claimed this yet.
- Dominant language
- C#
- Stars
- 576
- Forks
- 114
- Avg merge
- 1d 2h
- Merged PRs (30d)
- 7
Description
This bug by @jformacek is copied from https://github.com/MicrosoftDocs/PowerShell-Docs/issues/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-ModuleManifestremoves this attribute completely
RequiredAssemblies = if($PSEdition -eq 'Desktop') {@('lib\net45\someAssembly.dll')} else {$null}
- PrivateData attribute: I have added additional content as hashtable
Messagesto module'sPrivateDataas addtional hashtable aside fromPSDataas shown below, however,Update-ModuleManifestchanges theMessageshashtable toMessages = '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.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at the Update-ModuleManifest command and reproduce the report with a manifest containing RequiredAssemblies and nested PrivateData.Messages. Compare the manifest before and after updating only ModuleVersion. Done means unpassed attributes remain intact, including the nested Messages hashtable, with regression coverage for both reported cases.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- powershell
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100