Skip to content
This repository was archived by the owner on Jun 13, 2024. It is now read-only.
This repository was archived by the owner on Jun 13, 2024. It is now read-only.

Update-ScriptInfo requires non-mandatory parameters #48

@jianyunt

Description

@jianyunt

From @DouglasPlumley on June 2, 2016 20:55

PS version 5.0.10586.122, PowerShellGet version 1.0.0.1.

Whenever I try to update the script information in a ps1 file that already has the information I'm unable to proceed if I don't provide arguments to non-mandatory parameters.

[ValidateNotNullOrEmpty()]
[string]
$Copyright,

[Parameter()]
[ValidateNotNullOrEmpty()]
[String[]]
$ExternalModuleDependencies

This appears to be happening for all parameters, I've highlighted Copyright and ExternalModuleDependencies.

Update-ScriptFileInfo -Path "c:\test.ps1 -Version 1.0.0.0"

The variable cannot be validated because the value  is not a valid value for the Copyright variable.
At C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\1.0.0.1\PSModule.psm1:4313 char:13
+             $Copyright = $psscriptInfo.Copyright
+             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : MetadataError: (:) [], ValidationMetadataException
    + FullyQualifiedErrorId : ValidateSetFailure

The variable cannot be validated because the value $null is not a valid value for the ExternalModuleDependencies variable.
At C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\1.0.0.1\PSModule.psm1:4323 char:13
+             $ExternalModuleDependencies = $psscriptInfo.ExternalModul ...
+             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : MetadataError: (:) [], ValidationMetadataException
    + FullyQualifiedErrorId : ValidateSetFailure

I believe you are supposed to be able to provide no input and Update-ScriptInfo should maintain the current value even if it is "" or $null.

Copied from original issue: OneGet/oneget#185

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions