Beware the Team Test VSMDI file

Do you have a solution under Team Foundation source control that contains a Team Test project? If so, you need to be very, very careful about how the *.VSMDI (Visual Studio Test Metadata File) is handled in the Test project.

Kjell-Sverre Jerijærvi has a great post explaining why the *.VSMDI file becomes so problematic:

VS2005 automatically checks out the metadata file even when a developer is not working on a unit test, or even touching the test project or the test manager. The check-out is silent, so the developer won't notice. After some coding, the developer will try to check in pending changes. In the meantime, other developers may have worked on some unit tests, coding and check-ins, causing a conflict on the .VSMDI file. At this point, VSMDI is a disaster waiting to happen...

Never ever use 'auto merge' to resolve check-in conflicts on the .VSMDI file. The chances are that the file will get corrupted. If you have a conflict, I recommend discarding your local changes, get the latest version of the .VSMDI file from TFVC (use 'force get...' and 'overwrite...' if necessary), then re-apply your changes to the tests and test lists, and check the file in immediately. Do not keep the .VSMDI file checked out longer than strictly necessary.

We've run into this exact same problem on a project here at Vertigo, and it's ugly.

Until Microsoft publishes an official workaround Kjell-Sverre recommends switching the Visual Studio Team Test file types to non-mergable to avoid problems. I agree. Here's how:

From the Team menu, select Server Settings, then Source Control File Types:

Select the Visual Studio Team Test Files, and turn off "Enable file merging and multiple check out".

Keep an eye on the *.VSMDI file, as Visual Studio likes to check it out CONSTANTLY-- even when you do a get latest on the solution!

posted on Friday, June 23, 2006 7:45 PM by jatwood

Comments

# re: Beware the Team Test VSMDI file

Here is a work-around that seems to work -

1. Make sure Visual Studio is NOT set up to load the last-used solution file automatically (Tools -> Options, open Environment->Startup and make sure it does not say 'At startup: Load last loaded Solution'.

2. When you open a solution, make sure the Test View and Test Results windows are CLOSED. It seems that having these windows open when opening a solution causes the auto-checkout to occur.

3. Lastly, when you get the latest version of a solution, again make sure the Test View and Test Results windows are CLOSED. Same deal as above.
Sunday, April 15, 2007 1:34 PM by paaaal