Search code examples
azure-devopsazure-devops-extensions

Package shared code in VSTS extension


I'm writing a VSTS extension with build/release tasks in it. Where can I put code that is used by more than one task within an extension? Can I put it anywhere in the extension file tree (eg. the Common folder below) and then just use that path - will those files be downloaded by every agent running any task from the extension?

The directory structure I currently have looks like this:

My Extension
|- MyBuildTask
|   |- MyBuildTask.ps1
|   |- task.json
|- MyReleaseTask
|   |- MyReleaseTask.ps1
|   |- task.json
|- Common
|   |- MyModule.psm1
|-vss-extension.json

Solution

  • When you queue builds, anent only downloads the single task files, it's not able to share file between tasks. You have to pack all files the task needs in the task directory.