问题
We made a few fields in bugs required before allowing to resolve. However, when a developer tries to resolve with a checkin and those fields are not filled in, it still allows the checkin to occur w/out associating that bug - is there a way to NOT allow the checkin to occur so the developer fixes it, and the bug can be associated with it properly? here is the full message:
Failed to update the following work item:
ID 9073. Reason: TF237124: Work Item is not ready to save Changeset 548 successfully checked in.
Here is pertinent info from work item type definition:
<STATE value="Resolved">
<FIELDS>
<FIELD refname="Microsoft.VSTS.CMMI.ProposedFix">
<ALLOWEXISTINGVALUE />
<REQUIRED />
</FIELD>
<FIELD refname="Microsoft.VSTS.CMMI.RootCause">
<ALLOWEXISTINGVALUE />
<PROHIBITEDVALUES expanditems="true">
<LISTITEM value="Unknown" />
</PROHIBITEDVALUES>
</FIELD>
</FIELDS>
...
</STATE>
回答1:
If you are using TFS API
var result= wit.Validate();
Here it retunrs ArrayList and this will tell you why it is failing and for how many Fields
回答2:
No, the check-in and the work-item update are not "transactional" so the check-in will succeed. If you need this, you'll need to also create and distribute a Check-in policy.
The open source Code Review check-in policy uses a similar technique to ensure that all associated code-review workitems are updated.
If you want to give the developer an easy way to update the work-item pre-checkin, then you can use the Activate
event to show a UI and allow the developer to update the fields directly without having to open the work item in a separate form. My own checkin policy provides a nice example of that. I blogged about the steps to pop-up a UI.
You'll need to build and distribute the policy for every version of Visual Studio that connects to your TFS instance and reference the correct versions of the TFS client object model binaries. Different versions of Visual Studio also require to be compiled against different versions of the .NET framework. This is outlined in yet another blog-post I've written.
来源:https://stackoverflow.com/questions/31768141/tf237124-work-item-is-not-ready-to-save-on-associated-workitem-but-code-is-c