tfstfsbuildshelvesetgated-checkin

How can we fetch the shelveset name during Gated check-in and assign it to a variable in tfs build task


We have a mapped workspace where each project is having multiple references to other projects. On the same workspace, we perform our whole product build nightly.

When we enable gated check-in for individual projects, its creating a new workspace and trying to build. As the other projects are not mapped as part of gated check-in, its failing to build.

Do we have any way to fetch shelveset created during Gated check-in in the tfs build, so that we can use it to unshelve in our local mapped workspace?

Any help/lead is appreciated.


Solution

  • Do we have any way to fetch shelveset created during Gated check-in in the tfs build

    You can use the REST API Shelvesets - Get.

    GET https://{instance}/{collection}/_apis/tfvc/shelvesets?shelvesetId={shelvesetId}&api-version=5.0
    

    If you don't know the shelvesetId you need, you can use the REST API Shelvesets - List to get all your shelvesets.

    GET https://{instance}/{collection}/_apis/tfvc/shelvesets?api-version=5.0