Static content hosting
Azure DevOps Services
Choose to host static content for your extension, like HTML, CSS, and JavaScript files, on your own service, on a third-party hosting service, like Azure or Heroku, or on Azure DevOps Services directly.
Important
If your extension needs to create a custom table in the TFS database, do not create it using the 'dbo' schema. Instead, custom tables should be created in a separate schema. For example, 'YourExtensionName'.
Tip
Check out our newest documentation on extension development using the Azure DevOps Extension SDK.
Host on Azure DevOps Services
In this model, static content is packaged with your extension's .vsix file and is served from a public endpoint at https://publisher.gallerycdn.vsassets.io
.
Your extension's static content is useful when you're enhancing or decorating data from Azure DevOps Services. The extension pub doesn't require you (the extension publisher) to set up, manage, or pay for hosting services for your extension
Steps
- In your extension manifest file, specify the files you want to include via the
files
property:{ "files": [ { "path": "scripts", "addressable": true }, { "path": "images/extra/icon1.png", "addressable": true } ] }
- Remove the
baseUri
property (if set) from your extension manifest. - Package your extension (steps)
- Publish (or republish) your extension (steps)
Keep in mind:
- The value specified by the
path
attribute can be a folder or individual file. If a folder, the entire folder (and any subfolders) is included. - The
addressable
attribute is important and is what tells Visual Studio Codespaces to make the file(s) URL addressable. - All
addressable
asset requests are case-sensitive. If the request for an asset has a different case than the actual uploaded asset, it results in an HTTP 404 (Not found) error. - Not specifying a baseUri or setting an empty value tells Visual Studio Codespaces at runtime to calculate the base URI as if your static content's hosted by Azure DevOps Services.
Host on your own service (or a third-party service)
In this model, static content is served from your own service and not included in your extension's .vsix file.
Steps
- Set the
baseUri
property in your extension manifest For example, assuming a value ofhttps://myservice.net/extension
and this hub contribution:
"baseUri": "https://myservice.net/extension",
"contributions": [
{
"id": "Fabrikam.HelloWorld",
"type": "ms.vss-web.hub",
"targets": [
"ms.vss-work-web.work-hub-group"
],
"properties": {
"name": "Hello",
"uri": "hello-world.html"
}
}
]
Azure DevOps Services loads the contents of this hub when it's rendered at https://myservice.net/extension/hello-world.html
.