17

I've just installed TFS 2012 RC and Visual Studio 2012 RC. I see some interesting feartures: Code Review, Build Success before check-in. But it do not! So my question is:

  1. How to force Code Review before Check-In in TFS 2012 RC?
  2. How to force "Builds" Check-in Policy (not Gated Check-in)?
  3. What difference between "Builds" Check-in Policy and "Gated Check-in"?
Machavity
  • 30,841
  • 27
  • 92
  • 100
Vinh
  • 1,217
  • 2
  • 9
  • 9
  • 4
    I've created a custom check-in policy that will allow you to enforce "Code Review" at check-in time. You can get it from the VS gallery here: http://visualstudiogallery.msdn.microsoft.com/c476b708-77a8-4065-b9d0-919ab688f078 –  Dec 20 '12 at 21:26

2 Answers2

6

1) In team explorer, go to the "Settings" section. Choose "Source Control". When the window pops up, select the "Check-in Policy" tab. Click "add" and select the options you need.

2) Create a new build. On the "Trigger" tab, change to "Continuous Integration". This will force a build with every check in.

3) Gated check in requires a successful build to check in. Continuous Integration (CI) builds on check in (both options are found on the trigger tab in the build settings, and you can actually have both on different builds) A gated check in will basically store your check in as a changeset, run a build on it, and deny the check in if the build fails. CI checks in your code and runs a build, which may or may not fail.

Hope that helps!

Andrew Clear
  • 7,910
  • 5
  • 27
  • 35
  • 1
    1. There's no "Code Review" option in "Check-in Policy" tab! How could I add? – Vinh Aug 01 '12 at 02:51
  • 1
    Sorry, I thought there was. It is possible to create your own custom check in policy however. This blog post should get you started. [link](http://blogs.msdn.com/b/jimlamb/archive/2010/03/31/how-to-implement-package-and-deploy-custom-check-in-policy-for-tfs-2010.aspx) – Andrew Clear Aug 01 '12 at 04:55
  • Thanks, but I think I will waiting for TFS PowerTools 2012 or TFS 2012 RTM. And I hope Microsoft will support it natively. – Vinh Aug 01 '12 at 09:54
  • Here's the power tools for the rc: [link](http://visualstudiogallery.msdn.microsoft.com/27832337-62ae-4b54-9b00-98bb4fb7041a) – Andrew Clear Aug 01 '12 at 15:07
  • 1
    This may be an interesting read - Code Review Before or After Checkin - http://geekswithblogs.net/TarunArora/archive/2012/09/18/vs-2012-code-review-ndash-before-check-in-or-after.aspx . The only way I know how to do the force peer review is to remove developers ability to checkin and only allow them to shelve, the reviewer would effectively unshelve and check it in on their behalf. – Betty Oct 04 '12 at 07:31
  • @aclear16 is there anything to stop users from removing the policies you have set? – Fetchez la vache Mar 22 '13 at 09:46
  • 2
    @Fetchez: Fire them and hire people who want to be part of your team. – Andrew Clear Mar 22 '13 at 13:00
  • Check to make sure the policies are installed inside the build logic for your gated check-in build: http://social.msdn.microsoft.com/Forums/en-US/tfsprocess/thread/d2591317-98a3-4f71-8507-4887de0934a8 – Andrew Clear Mar 22 '13 at 15:24
  • @Vinh, the code review option for TFS2012 is in the "Check-in Notes" section, not the "Check-in policy" – Neville Oct 16 '16 at 21:49
2

There are a couple of Code Review checkin policies that you can install in Visual Studio and configure for you Team Project. These will enforce that a Code Review work item is linked to the changes before you can check them in:

enter image description here

jessehouwing
  • 106,458
  • 22
  • 256
  • 341