I need an on-prem version of the Visual Studio Team Services extension!
Looking at the Visual Studio Team Services Features Timeline, it is evident that the cadence in the cloud is a lot faster than TFS on-premises. As a result, there’s a disparity between the two environments for extensions, widgets, services, and the APIs.
Optimally we would like to release the same extension, with the same features, to all environments. However, due to the disparity the typical scenarios are:
- Release a cloud-only extension
Not your favourite scenario, looking at some of the marketplace feedback.
, - Release a cloud extension with different features when running on TFS on-premises
For example, the Folder Management, version 1.2.5, creates a folder in team Foundation Version Control (TFVC) without creating a placeholder file, using the …/api/tfvc/changesets#CreateachangesetAddafolder. Running the same extension TFS on-premises still creates the placeholder file, as the TFVC REST API feature is not yet available.
Are we running on-prem or in the cloud?
Use this code snippet, if you need to different behaviour for your extension when running in the cloud or on-prem:
import Context = require(“VSS/Context”);
Context.getPageContext().webAccessConfiguration.isHosted
Looking at the Folder Management repo you can explore how Wouter de Kort used the snippet in the extension.
- Check if we are running in the cloud
- If no, call the on-prem function
- If yes, call the cloud function
Thoughts?
Add a comment below or ping us here.