azure-pipelinesvisual-studio-extensionsazure-pipelines-build-taskvsixmanifest

Custom Build Task for VSTS - package multiple tasks in one VSIX?


Is it possible to "bundle" multiple custom VSTS build tasks in one VSIX file.

I can see how it would be best practice (single responsibility and all) to create one extension per task, but is it possible?

If so, an example manifest, and a link to someone who has done this would be very appreciated.

My intended file structure is. It will be very easy to switch to one vsix per task if I have to.

Custom-Tasks
  - Task1
    - task.json
    - task.ps1
  - Task2
    - task.json
    - task.ps1
  - Task3
    - Task3V1
      - task.json
      - task.ps1
    - Task3V2
      - task.json
      - task.ps1
  extension-icon.png
  extension-manifest.json
  extension-tests.ps1
  build-publish.ps1

Thanks!


Solution

  • Just add multiple files and contributions, one for each task.

    Ex:

    "files": [
        {
            "path": "Task1"
        },
        {
            "path": "Task2"
        },
        {
            "path": "Task3"
        }
    ],
    "contributions": [
        {
            "id": "task-1-guid",
            "type": "ms.vss-distributed-task.task",
            "targets": [
                "ms.vss-distributed-task.tasks"
            ],
            "properties": {
                "name": "Task1"
            }
        },
        {
            "id": "task-2-guid",
            "type": "ms.vss-distributed-task.task",
            "targets": [
                "ms.vss-distributed-task.tasks"
            ],
            "properties": {
                "name": "Task2"
            }
        },
        {
            "id": "task-3-guid",
            "type": "ms.vss-distributed-task.task",
            "targets": [
                "ms.vss-distributed-task.tasks"
            ],
            "properties": {
                "name": "Task3"
            }
        }
    ]
    

    Any number of extensions on the marketplace have multiple tasks bundled in them that you can use as a reference.