-->

How to prevent TFS from deleting shelvesets that w

2019-09-13 03:12发布

问题:

Checking in shelvesets is a nice feature of the build system in TFS, but the shelveset is deleted after the build finishes. Is there a way to change this behavior so that the shelveset is preserved?

I use the build+check in shelveset feature all the time to check in code from teammates, but sometimes I don't want the original shelveset to be deleted by TFS. In some situations, this can cause problems, like when the shelveset is associated with a code review work item. In that case, all comments from the code review are hidden by Visual Studio because it can't find the associated shelveset.

I searched on the default properties window when queuing the build in Visual Studio but there doesn't seem to exist any option to control this behavior. Will I have to customize the build xaml to change this, or is there a known way without having to get to that?

回答1:

If you mean build+ check in shelveset is building shelveset and check in the changes after build successful as below:

Then it's impossible. Since you have checked in your shelveset. This is not related to build. So this question is the same as how to check in shelveset and prevent deleting shelvesets. Shelve saving all of the changes on your box without actually checking in. The changes are persisted on the server. So other team members can see the source code and can also check in other's shelvest.

You can also treat is as a kind of container.

  • You create your file and commit it to a shelveset (container A).
  • You then go to the build agent and get that Shelveset into the local workspace (container B)
  • You then commit the shelveset (from container A to source control) the check in from Container A is successful and Container A is deleted to reflect that the Gated Shelveset has completed it's life cycle (if it failed it would remain intact)