Using BaseUri to develop your VSTS extension


When you work on your Visual Studio Team Services or Team Foundation Server extension, you need a VSTS or TFS environment to deploy your extension to. To deploy your extension, you package all your JavaScript, HTML and CSS files into a VSIX and deploy the complete package.

This means that for every small change you make, you need to completely redeploy the package and then use your browser to validate the changes. Fortunately, there is an easier way to pickup changes while developing your extension.

BaseUri property for your manifest

While working on your extension, you can add a the property baseUri to your JSON manifest file. If this property is not present, all your files will be loaded from VSTS or TFS. When you add this property, you override the default location of your assets. By letting this property point to your local host you can serve the files locally and your extension will load them into the context of VSTS or TFS.

Take for example the following portion of a manifest:

 "manifestVersion": 1,
 "id": "AnotherSampleExtension",
 "version": "0.0.0",
 "publisher": "",
 "name": "Another Sample Extension",

Now you can add the the following line to enable serving your extension from your local host:

baseUri: "https://localhost:5000",

Do make sure that you specify a HTTPS enabled URL. Now while working on your extension, you can run the extension in the context of VSTS or TFS while are your local file changes are picked up without republishing your extension.

When you are finished with development, just remove the baseUri from your manifest file and publish the extension to the marketplace.