我紧紧跟随的设计指导中发现here,here和here,但我不断收到此错误的PowerShell:TFS 2015.3自定义生成步骤不发送变量脚本
Cannot process command because of one or more missing mandatory parameters: SourcePath FilePattern BuildRegex.
相关配置数据低于。
我已检查并重新检查以确保变量存在于我的task.json
文件中。我还查看了其他工作任务(例如VSBuild)的配置,变量声明和PowerShell执行语法没有显着差异。
这里可能会出现什么问题?这是一个非常简单的架构 - 没有太多可以打破的地方。但显然有些事情已经做到了。
从task.json
:
"inputs": [
{
"name": "SourcePath",
"type": "filePath",
"label": "Source path",
"defaultValue": "",
"required": true,
"helpMarkDown": "Path in which to search for version files (like AssemblyInfo.* files). NOTE: this is case sensitive for non-Windows systems."
},
{
"name": "FilePattern",
"type": "string",
"label": "File pattern",
"defaultValue": "AssemblyInfo.*",
"required": true,
"helpMarkDown": "File filter to replace version info. The version number pattern should exist somewhere in the file(s). Supports minimatch. NOTE: this is casese sensitive for non-Windows systems."
},
{
"name": "BuildRegEx",
"type": "string",
"label": "Build RegEx pattern",
"defaultValue": "\\d+\\.\\d+\\.\\d+\\.\\d+",
"required": true,
"helpMarkDown": "Regular Expression to extract version from build number. This is also the default replace RegEx (unless otherwise specified in Advanced settings)."
},
{
"name": "BuildRegExIndex",
"type": "string",
"label": "Build RegEx group index",
"defaultValue": "0",
"required": false,
"helpMarkDown": "Index of the group in the Build RegEx that you want to use as the version number. Leave as 0 if you have no groups.",
"groupName": "advanced"
},
{
"name": "ReplaceRegEx",
"type": "string",
"label": "RegEx replace pattern",
"defaultValue": "",
"required": false,
"helpMarkDown": "RegEx to replace with in files. Leave blank to use the Build RegEx Pattern.",
"groupName": "advanced"
},
{
"name": "ReplacePrefix",
"type": "string",
"label": "Prefix for replacements",
"defaultValue": "",
"required": false,
"helpMarkDown": "Prefix for the RegEx result string.",
"groupName": "advanced"
},
{
"name": "ReplaceSuffix",
"type": "string",
"label": "Suffix for replacements",
"defaultValue": "",
"required": false,
"helpMarkDown": "Suffix for the RegEx result string.",
"groupName": "advanced"
},
{
"name": "FailIfNoMatchFound",
"type": "boolean",
"label": "Fail if no target match found",
"defaultValue": "false",
"required": false,
"helpMarkDown": "Fail the build if no match is found for the replace RegEx in the target file(s).",
"groupName": "advanced"
}
],
"execution": {
"PowerShell3": {
"target": "VersionAssembly.ps1"
}
}
从VersionAssembly.ps1
:
[CmdletBinding()]
param(
[string][Parameter(Mandatory=$True)][ValidateNotNullOrEmpty()] $SourcePath,
[string][Parameter(Mandatory=$True)][ValidateNotNullOrEmpty()] $FilePattern,
[string][Parameter(Mandatory=$True)][ValidateNotNullOrEmpty()] $BuildRegex,
[string]$BuildRegexIndex,
[string]$ReplaceRegex,
[string]$ReplacePrefix,
[string]$ReplaceSuffix,
[string]$FailIfNoMatchFound,
[string]$BuildNumber = $ENV:BUILD_BUILDNUMBER
)
@ScottLangham:你碰到了哪个版本?请参阅[任务版本](https://docs.microsoft.com/en-us/vsts/build-release/concepts/process/tasks#task-versions)中的特定文档,其中声明:“*当新的未成年人版本发布时(例如1.2到1.3),你的构建版本或发布版本将自动使用新版本,但是如果发布了新的主版本(例如2.0),你的构建版本或版本将继续使用你的主版本指定直到您编辑定义并手动更改为新的主要版本。*“ – eggyal
我在版本中尝试了次要和补丁字段。 –
@ScottLangham - 我已经将自定义任务设置为暂时的一方,但是如果我继续努力并为此找到解决方法,我会将其发送给您。 – InteXX