gpt4 book ai didi

powershell - 如何在 powershellgallery 中将脚本声明为预发布版?

转载 作者:行者123 更新时间:2023-12-05 07:19:17 26 4
gpt4 key购买 nike

我希望能够使用 update-script -allowprerelease 更新我的脚本。在使用 Publish-Script 发布脚本之前,我不确定如何将脚本标记为预发布。我该怎么做?

我试过了

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

这将以下内容添加到脚本中,但不起作用:

.PRIVATEDATA System.Collections.Hashtable

最佳答案

模块 list 在 PrivateData 键下声明其预发布标签,但脚本 list 可以简单地在 .VERSION 元数据属性中声明它:

<#PSScriptInfo
.VERSION 1.0.0-beta

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

.AUTHOR Bobby Dore
#>

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

编辑:

转换为 PowerShell 命令,解决方案归结为 Update-ScriptFileInfo -Path "/path/to/script.ps1"-Version "1.0.0-beta"

关于powershell - 如何在 powershellgallery 中将脚本声明为预发布版?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57847244/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com