我一直盯着这里看了一段时间的教程,但是我只是想不出一个解决方案。.https://docs.microsoft.com/en-us/azure/devops/extend/?view=vsts
我想创建一个自定义发行任务,该任务使用一些参数执行SomeImportTool.exe。
当前,我将命令行任务与以下
结合使用Display name:
Run SomeImportTool
Tool:
$(System.DefaultWorkingDirectory)/SomeImportTool/SomeImportTool.exe
Arguments:
-f "$(XmlFile)" -c "$(ConnectionString)" -l "$(CultureCode)"
我如何创建基本上做到这一点的Task.json?
{
"id": "{{taskguid}}",
"name": "SomeImportTool",
"friendlyName": "Run Some Resource Import Tool",
"description": "Run Some Resource Import Tool",
"helpMarkDown": "",
"category": "Deploy",
"visibility": [
"Release"
],
"author": "{{author}}",
"version": {
"Major": 0,
"Minor": 1,
"Patch": 0
},
"instanceNameFormat": "Echo $(SomeImportTool)",
"groups": [
{
"name": "advanced",
"displayName": "Advanced",
"isExpanded": false
}
],
"inputs": [
{
"name": "XmlFile",
"type": "string",
"label": "XmlFile",
"defaultValue": "",
"required": true,
"helpMarkDown": "File path to the resource file"
},
{
"name": "CultureCode",
"type": "string",
"label": "Culture Code",
"defaultValue": "",
"required": true,
"helpMarkDown": "culture code"
},
{
"name": "ConnectionString",
"type": "string",
"label": "Connection String",
"defaultValue": "",
"required": true,
"helpMarkDown": "Connection string"
}
],
"execution": {
"PowerShell3":{
"target": "someApplication.exe",
"platforms":[
"windows"
],
"workingDirectory" : "$(currentDirectory)"
}
}
}
答案 0 :(得分:1)
您可以引用vsts-task CmdLine或AzurePowerShell任务的源代码:
{
"name": "ScriptArguments",
"type": "string",
"label": "Script Arguments",
"defaultValue": "",
"visibleRule": "ScriptType = FilePath",
"required": false,
"properties": {
"editorExtension": "ms.vss-services-azure.parameters-grid"
},
"helpMarkDown": "Additional parameters to pass to PowerShell. Can be either ordinal or named parameters."
},