TFS Custom Build Tasks - Multiple versions

落爺英雄遲暮 提交于 2020-02-04 22:56:59

问题


I need to make changes to a custom TFS build task. I'd like to bundle the new version of the task in my extension (leaving the current version in as well) and be able to select the version when editing a build/release definition.

I've looked over Microsoft's documentation for bundling multiple versions of a build task within one extension, but I'm not seeing the details of what needs to be included in the extension manifest.

I've also looked at the VSTS Tasks on github and I'm not seeing how to accomplish this.

Does anyone have an example of how to bundle multiple versions of a task in one extension?


回答1:


This works for Visual Studio Team Services, you may have to wait until TFS 2017u2 is out to be able to do this against TFS.

  • Create a parent folder for both tasks (Task)
  • Put each build task in its own folder (Task\TaskV1, Task\TaskV2).
  • Make sure they're different by major version in the task.json
  • Make sure they have the same TaskID and TaskName
  • In the vss-extension.json include the files for both versions
  • In the vss-extension.json include a single contribution for the task and reference only the parent folder (Task).

So like this:

 "contributions": [ 
     { 
         "id": "Task", 
         "type": "ms.vss-distributed-task.task", 
         "targets": [ "ms.vss-distributed-task.tasks" ], 
         "properties": { "name": "Task" } // reference task root folder here.
     },
 ]

See also

  • https://jessehouwing.net/vsts-relnote-ci-cd-tools-for-vsts-extensions-1-1-75/
  • Demo project I use for testing: https://github.com/jessehouwing/vsts-ping-task-demo


来源:https://stackoverflow.com/questions/43789135/tfs-custom-build-tasks-multiple-versions

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!