PSResourceGet icon indicating copy to clipboard operation
PSResourceGet copied to clipboard

ScriptsToProcess property must be valid before being able to update

Open codaamok opened this issue 5 years ago • 5 comments

If my current module manifest includes a ScriptsToProcess property with invalid values (i.e. files that do not exist), I cannot update it using Update-ModuleManifest. An exception is thrown.

For example, the below may be the current value for ScriptsToProcess in my module manifest, and the referenced files do not exist.

...
ScriptsToProcess = '.\ScriptsToProcess\I-DoNotExist.ps1', 'ScriptsToProcess\I-AlsoDoNotExist.ps1'
...

I think it would be ideal to allow the user to replace the existing values, even if they're not valid.

PS C:\> Update-ModuleManifest -Path .\mymodulemanifest.psd1 -ScriptsToProcess '.\SomeScript.ps1'

Update-ModuleManifest: Cannot update the manifest properly. 'The member 'ScriptsToProcess' in the module manifest is not valid: Cannot find path 'C:\git\PSCMContentMgmt\build\PSCMContentMgmt\.\ScriptsToProcess\Import-CMModule.ps1' because it does not exist.. Verify that a valid value is specified for this field in the 'C:\git\PSCMContentMgmt\build\PSCMContentMgmt\PSCMContentMgmt.psd1' file.'
PS C:\> get-command Update-ModuleManifest

CommandType     Name                                               Version    Source
-----------     ----                                               -------    ------
Function        Update-ModuleManifest                              2.2.4.1    PowerShellGet

PS C:\> $PSVersionTable

Name                           Value
----                           -----
PSVersion                      7.0.3
PSEdition                      Core
GitCommitId                    7.0.3
OS                             Microsoft Windows 10.0.19041
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

codaamok avatar Jul 23 '20 22:07 codaamok

Issue-Label Bot is automatically applying the label bug to this issue, with a confidence of 0.70. Please mark this comment with :thumbsup: or :thumbsdown: to give our bot feedback!

Links: app homepage, dashboard and code for this bot.

issue-label-bot[bot] avatar Jul 23 '20 22:07 issue-label-bot[bot]

@alerickson is this due to be fixed in newer version of PowerShellGet?

codaamok avatar Nov 21 '20 08:11 codaamok

Same is true for FileList.

codaamok avatar Sep 18 '21 08:09 codaamok

Any update on this? It's still not fixed in almost 2025

CommandType     Name                                               Version    Source
-----------     ----                                               -------    ------
Function        Update-ModuleManifest                              2.2.5      PowerShellGet

SOM-Scott avatar Dec 10 '24 15:12 SOM-Scott

Update-ModuleManifest -Path ./Module.psd1 -FunctionsToExport $functionstoexport `
-NestedModules $srcfiles -RequiredAssemblies @('System.Runtime.Serialization')

The issue also applies to RequiredAssemblies.

Cannot update the manifest properly. 'The specified RequiredAssemblies entry 'System.Runtime.Serialization' in the module manifest '/Module/Module.psd1' is invalid. Try again after updating this entry with valid values.

fm-knopfler avatar Dec 17 '24 11:12 fm-knopfler