{"id":4393,"date":"2006-01-10T09:47:00","date_gmt":"2006-01-10T09:47:00","guid":{"rendered":"https:\/\/blogs.msdn.microsoft.com\/buckh\/2006\/01\/10\/locks-based-on-file-types-extensions-and-shelving\/"},"modified":"2006-01-10T09:47:00","modified_gmt":"2006-01-10T09:47:00","slug":"locks-based-on-file-types-extensions-and-shelving","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/buckh\/locks-based-on-file-types-extensions-and-shelving\/","title":{"rendered":"Locks based on file types (extensions) and shelving"},"content":{"rendered":"<p>Recently, someone asked about locks, shelving, and buddy builds (i.e., shelving your changes and unshelving and&nbsp;building them in another workspace to make sure everything builds cleanly).<\/p>\n<blockquote>\n<p>I am trying to add a number of files into our source control.&nbsp; The list of files I want to add contains a few each of .ico and .bmp, and one .xls files, all which get locked (locked to prevent check-out) when I add them, presumably because they cannot be merged if someone else checks them out and changes them.<\/p>\n<p>The fact that they get locked seems to deny the possibility of buddy building, even on my own second machine, because they are locked on a by-workspace rather than by-user basis.<\/p>\n<p>I tried selecting the binary items in the hierarchy under the Source Control Explorer, and right-clicking to the &ldquo;unlock&rdquo; command, but it always says that the file could not be found in my workspace.<\/p>\n<p>What am I missing?&nbsp; A preference setting or checkbox somewhere that does not lock added binary files?&nbsp; Is there some way to turn off or override my own lock?&nbsp; Is it really not possible to unshelve shelvesets containing binary files to a second machine?<\/p>\n<\/blockquote>\n<p>Locking and shelving, while keeping the changes in your workspace, don&#8217;t mix.&nbsp; The files that are configured to be locked via file type extension (in VS, Team -&gt; Team Foundation Server Settings -&gt; Source Control File Types) are locked exclusively.<\/p>\n<p>An exclusive checkout lock prevents any other changes from being pended on the file involved.&nbsp; The file type locking mechanism prevents user from unlocking files that are locked via that mechanism.&nbsp; So, to do a buddy build, you would need to shelve and undo, which is best accomplished by either unchecking the &ldquo;Preserve local changes&rdquo; checkbox in the GUI shelve dialog or using the \/move option on the shelve command.&nbsp; Alternatively, you can change the file types to allow multiple checkout.<\/p>\n<p>The problem is even worse for users where exclusive checkout is turned on for an entire team project, as even plain text files are locked exclusively in that case.&nbsp; As with the file type extension locking mechanism, users cannot unlock files that are locked due to the team project setting.&nbsp; When you shelve, you need to move the changes to the shelveset (don&#8217;t keep them in your workspace).<\/p>\n<p>For us, the file type locking causes problems both with buddy builds and with a check-in system we use called <a href=\"http:\/\/blogs.msdn.com\/hippietim\/archive\/2005\/02\/07\/368705.aspx\">gauntlet<\/a>.&nbsp; With gauntlet, we shelve our changes and submit them to gauntlet for it to build them and check them in.&nbsp; It can&#8217;t unshelve any item that requires an exclusive lock if you still have the pending change in your own workspace.&nbsp; As a result, we&#8217;ve turned off exclusive checkout based on file extensions by changing each to allow multiple checkout.<\/p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Recently, someone asked about locks, shelving, and buddy builds (i.e., shelving your changes and unshelving and&nbsp;building them in another workspace to make sure everything builds cleanly). I am trying to add a number of files into our source control.&nbsp; The list of files I want to add contains a few each of .ico and .bmp, [&hellip;]<\/p>\n","protected":false},"author":94,"featured_media":10268,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1],"tags":[6,8],"class_list":["post-4393","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-uncategorized","tag-source-control","tag-team-foundation"],"acf":[],"blog_post_summary":"<p>Recently, someone asked about locks, shelving, and buddy builds (i.e., shelving your changes and unshelving and&nbsp;building them in another workspace to make sure everything builds cleanly). I am trying to add a number of files into our source control.&nbsp; The list of files I want to add contains a few each of .ico and .bmp, [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/buckh\/wp-json\/wp\/v2\/posts\/4393","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/buckh\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/buckh\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/buckh\/wp-json\/wp\/v2\/users\/94"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/buckh\/wp-json\/wp\/v2\/comments?post=4393"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/buckh\/wp-json\/wp\/v2\/posts\/4393\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/buckh\/wp-json\/wp\/v2\/media\/10268"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/buckh\/wp-json\/wp\/v2\/media?parent=4393"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/buckh\/wp-json\/wp\/v2\/categories?post=4393"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/buckh\/wp-json\/wp\/v2\/tags?post=4393"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}