PowerShell / PowerShell/PSResourceGet

Update-ModuleManifest corrupts PrivateData in module manifest

Aperta
#307 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Area-InfoFile Issue-Bug
Lingua principale
C#
Stelle
576
Fork
114
Merge medio
1g 2h
PR unite (30g)
7

Descrizione

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

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Direzione di ricerca

Inizia dal comando Update-ModuleManifest e riproduci il report con un manifest contenente RequiredAssemblies e PrivateData.Messages annidato. Confronta il manifest prima e dopo l'aggiornamento della sola ModuleVersion. Il lavoro è completato quando gli attributi non passati rimangono intatti, inclusa la tabella hash Messages annidata, con copertura di regressione per entrambi i casi segnalati.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
powershell
Ambito
tooling
Tipo di issue
Bug
Difficoltà
4/5
Tempo stimato
3-5 giorni
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
42/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.