I recently had a team ask me about changing the default check in option from Resolve to Associate in Team Foundation Server 2012 (TFS 2012). I did some research and found there is a lot of confusion around the available options. I am going to describe the two main options to help you decide which option will work best for you and your team. So, why is changing this important? Our Deliveron ALM Delivery Guidance recommends that each person should update his/her tasks before stand-up each day. We also recommend the hours be zeroed out for completed tasks, however the task should be left open until stand-up. During the stand-up the task will be moved from Active to Closed where the team can celebrate the victory. I have seen teams use clapping, snaps, and noise makers to name a few. When developers check-in his/her code, they should always associate the check-in to the appropriate work item(s) but not choose Resolve. Resolve is the default option but by choosing this, it will automatically close the Task bypassing being able to close it during the stand-up.
Figure 1 – Resolve is the default option for Tasks and Bugs
Changing the option to Associate each time seems small but it would be nice to change the default option from Resolve to Associate. In TFS 2010 it was relatively simple to change this by updating a registry key. However, in TFS 2012 there are two options that address this in different ways. Both options have some drawbacks. I will explain the two options and let you make the decision which you prefer.
Removing the Check-In Action from the Work Item Template (WIT)
One way to address this is to remove the Check-In action from each WIT. Using the TFS Power Tools, you can remove the Action from the Transition. In the Task, you need to remove it from the New –> Closed and the Active –> Closed transitions. To do this, double click on the Transition title bar to open the Workflow Transition dialog. Navigate to the Actions tab and delete the Action. In addition to the Task, you should also remove this from the Bug WIT since these are the two types of work items that you would typically associate your check-ins to.
Figure 2 – Removing the Check-In action from the WIT
Once the WITs have been updated into your team project this will be available for all users. Now when you add a related work item, the only option available is Associate.
Figure 3 – The default and only option is Associate
As I mentioned, this solution has some pros and cons. Here is a few to consider:
- This change only has to be made the Team Project and nothing has to be done on the clients.
- We recommend not resolving the work item, so removing this option is not a big deal.
- This would need to be applied to all current Team Projects and would need to update the Process Template for future Team Projects.
- This removes the Resolve option for users, so there is no way to perform this action anymore.
Updating Visual Studio clients to change the default option to Associate
This option sounds good. Unfortunately it only works under one scenario. With the Team Explorer 2012, there are two primary ways to initiate a check in. You can initiate the check in from the Pending Changes Pane and from My Work Pane. By default if you initiate the check-in from either location, the default option will be Resolve. Once this fix has been applied, it will update the default option when initiating the action from the My Work pane but not the Pending Changes Pane. I will show you how to set this up but first I will show you the scenario that doesn’t work and the one that does work.
From my experience, most check-ins are initiated from the Pending Changes pane or by right clicking on a location in Solution explorer. Either way you will end up on the Pending Changes pane, where you can associate a work item by query or by ID. Unfortunately the change has no effect on this and will continue to default to the Resolve option as shown below.
Figure 4 – Pending Changes still defaults to Resolve after updating the registry key.
In Team Explorer 2012, there is a new Pane called My Work. This Pane is designed to group and manage all of your current work including code, break points, and associated work items. This provides the ability to suspend/resume your current work so you can switch to work on something else and then come back to it later with everything the way you left it. After applying the update, initiating the check-in from here will change the default option to Associate.
Figure 5 – Initiating the check in from My Work changes the default to Associate after the updating the registry key.
Now that you understand the scenarios. To enable this option, each Visual Studio user will need to update the following registry key and change ResolveAsDefaultCheckinAction = False.
Figure 6 – Set ResolveAsDefaultCheckinAction = False
Next, exit all instances of Visual Studio 2012. Open the Developer Command Prompt for VS 2012 with administrator privileges. Run devenv /setup to ensure that the registry is picked up by Visual Studio.
Figure 7 – Run devenv /setup to ensure registry change is applied.
With the change applied, the default option is changed for your My Work initiated check ins.
For this option, here are several pros and cons:
- This change only has to be made once for it to apply to all TFS servers and Team Projects that you use.
- This keeps the Resolve option for the most flexibility.
- Only developers that want to change the default option will be affected.
- Most check ins are initiated from the solution or Pending Changes where this update does not work.
- Each Visual Studio user needs to perform this update for it to work for them.
As you can see there isn’t a perfect option. Hopefully this gives you a complete picture of the options so you can make the best decision for your team. We chose the first option because the Resolve option would be rarely used.