Monday, 10 December 2012

Visual Studio Designer and TFS Lock

If you have used XAML technologies (Silverlight, WPF, etc.) and Team Foundation Server (TFS), you would be aware of merge issues that might happen with multiple check-outs. The multiple check-out functionality is supported by it's ability to merge code changes. However, due to the nature of XAML code, it is tremendously difficult to get the merging right.

A workable solution is to disable file merging for XAML and XAMLX files. This can be configured through  Team Project Collection settings. If you are using Visual Studio 2012, clicking on the Source Control option shows the following option:


Click on the Add button and add the name and file extension for XAML and disable the option "Enable file merging and multiple check out".


Disabling this option means that TFS locks the file for all other users once it is checked out by anyone. If a user attempts to explicitly check out the a locked file, an error message is shown to the user. However, if the user attempts to do it implicitly by editing a file, the error is shown in the output window.

Now, here is something which I got me burnt today. For text based such as .cs, .xml, etc. the behaviour of Visual Studio 2012 is what I expected i.e. the file is locked for editing and it is very obvious that the files are not checked out. However, if the file is opened on visual studio designer such as Workflow files, Visual Studio still allows you to drag activities on to the designer but the file is not written to. So, keep an eye on the  lock icon .



No comments: