3

I want to be able to update my script using update-script -allowprerelease. I'm not sure how to mark the script as prerelease before using Publish-Script to publish it. How do I do it?

I tried

$Params = @{
    PrivateData = @{
        PSData = @{
            PreRelease = 'Testing'
            }
        }
    }
Update-ScriptFileInfo @Params -PassThru

This added the following to the script, which didn't work:

.PRIVATEDATA System.Collections.Hashtable

Bobby Dore
  • 499
  • 5
  • 13
  • 1
    The `-PrivateData` parameter is `[string]`-typed, so you cannot pass a hashtable - even though that would make sense. A shot in the dark: try passing the hashtable literal as a _string_: `PrivateDate = '@{ ... }'` – mklement0 Sep 09 '19 at 02:46
  • Thanks, I tried that but unfortunately it didn't help. – Bobby Dore Sep 09 '19 at 16:28

1 Answers1

0

A module manifest declares its prerelease label under the PrivateData key, but a script manifest can simply declare it in the .VERSION metadata property:

<#PSScriptInfo
.VERSION 1.0.0-beta

.GUID 2c3b0ebf-4702-4d85-abc9-46053591a9d0

.AUTHOR Bobby Dore
#>

See Prerelease versions of scripts:

PowerShellGet support for prerelease versions is easier for scripts than modules. Script versioning is only supported by PowerShellGet, so there are no compatibility issues caused by adding the prerelease string. To identify a script in the PowerShell Gallery as a prerelease, add a prerelease suffix to a properly-formatted version string in the script metadata.

Edit:

Translated to a PowerShell command, the solution comes down to Update-ScriptFileInfo -Path "/path/to/script.ps1" -Version "1.0.0-beta".

Michiel van Oosterhout
  • 22,839
  • 15
  • 90
  • 132