简体   繁体   中英

Using local workspaces with TFS2012/VS2012: can I change the default lock type for checkouts?

Our team is using local workspaces. I know server workspaces provide better locking functionality, but the "check in lock" that is possible with local workspaces is sufficient for us. It's a bit of a hassle though, because for non-source files (typically, .rpt files) we have to:

  1. Get the latest version of the file.

  2. "Check Out For Edit".

  3. Change the lock type to "Check in - Allow other users to check out but prevent them from checking in".

Is it possible to, at least, change the default lock type for certain file types (.rpts) so that #3 above is done automatically? Ideally, it would be nice if this applied to automatic check-outs as well, if VS is configured to check out automatically when editing/saving.

Now I know this is an old post and I'm not sure of the differences between VS2012 with TFS2012 and VS2015 with TFS2015, but I thought I'd share my solution, in case it help you or anyone else.

While there is not an option to completely automatically "Check-in lock" a file when you edit it that I can find, I did find that you could have it prompt for the check-in lock with that lock already selected.

MY SOLUTION:

You go Tools > Options then select the Source Control > Environment and under Editing select "Prompt for lock on checkout"

在此处输入图片说明

Now when ever you open a file and begin editing it, the moment you make a change it will pop up a window like this:

在此处输入图片说明

Note: that it has the lock type set to the check-in lock automatically. If you had selected the "Prompt for check out" selected in the options form, it would pop up the same for, but with the "Unchanged" option selected.

One other important thing to note, is if you hit cancel in the Check Out form, it will proceed to edit the file, but without checking it out, which may be undesirable.

That covers your Points #2 and #3

As for point #1

Again, I don't know about VS2012 and TFS2012, but with 2015 you go to: Team Explorer > Settings > Source Contol (under the team project node)

在此处输入图片说明

You then check "Enable Get Latest on Check Out"

在此处输入图片说明

After both settings have been changed:

  1. You can check out a file just by starting to edit it
  2. The program will get the latest file when you check it out.
  3. And it will show a prompt confirming the check-in lock before check out.

Again I'm aware that this answer is coming a little late, and it is done using 2015 software not 2012, but I hope it applies for you, and perhaps this post will help someone else.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM