Help and Support

Article ID: 949476 - Last Review: February 20, 2008 - Revision: 1.1

Moving files between projects in Solution Explorer removes source control history, breaking merge capabilities

Expand all | Collapse all
Source: Microsoft Support

RAPID PUBLISHING

RAPID PUBLISHING ARTICLES PROVIDE INFORMATION DIRECTLY FROM WITHIN THE MICROSOFT SUPPORT ORGANIZATION. THE INFORMATION CONTAINED HEREIN IS CREATED IN RESPONSE TO EMERGING OR UNIQUE TOPICS, OR IS INTENDED SUPPLEMENT OTHER KNOWLEDGE BASE INFORMATION.

Action

You have a Microsoft Visual Studio solution in Microsoft Team Foundation Server source control. The solution contains more than one project. You move a file from one project to another using the Visual Studio Solution Explorer.

Result

The moved file has only one source code control history item after the move: an "add" action. All previous history is gone.

Cause

This occurs because the back-end source code control actions taken when the file is moved between solution projects in the Solution Explorer are a DELETE and an ADD. The DELETE action removes the source code control history from the file. If the file was branched, this removes the merge capabilities from the file as well, because the branch action history item was also deleted.

Resolution

Use a combination of the Microsoft Visual Studio Source Control Explorer and the Solution Explorer to move files between projects in a solution, rather than just the Solution Explorer. To do this, first check in any changes and close the solution in Visual Studio, and then:

  1. Open the Source Control Explorer.
  2. Move the file between Visual Studio projects using the Source Control Explorer. To do this, right-click the file and then select MOVE. Select the destination project and then click OK on the MOVE dialog. Check in Pending Changes to complete the action.
  3. Check out the entire solution. You should note that the file you moved will appear with a different glyph in the Solution Explorer, in the project you moved *from*. It should have a yellow exclamation point. Right-click this file and then select "Delete".
  4. In Solution Explorer, right-click on the project you moved *to* and select "Add>Existing Item...". You should find your moved file in the project's local directory.
When you check the history of the moved file you will note that all previous history, including the rename change (the result of the move you performed), is still there. In addition, if this file had been branched you will be able to select a target branch using the Source Control Merge Wizard.

More Information

Steps To Reproduce

  1. Create a new solution in Visual Studio 2005 or 2008 with two projects ("PROJ1" and "PROJ2"). Add everything to source code control in Team Foundation Server.
  2. Create some history on one file in PROJ1: check it out/add some comments/check it in. Do this three or four times.
  3. Check everything in and then use the Source Control Explorer to branch PROJ1, selecting the default options. Remember to check in Pending Changes to commit the branch operation.
  4. Using the Visual Studio Solution Explorer, move the file (the one you added history to in step 2) from PROJ1 to PROJ2 (SHIFT+LEFT-CLICK/DRAG will MOVE the file). At this point the Pending Changes window should show you a "DELETE" change on the file moved for PROJ1 and an "ADD" change for the file in PROJ2. 
  5. Check in the Pending Changes.

    Using the Source Control Explorer view the history on the file you moved. You should notice that it only has one history entry - an ADD. In addition, you will not be able to select a target branch using the Source Control Merge Wizard (right-click the file in the Source Control Explorer and select "Merge" to see this). 

DISCLAIMER

MICROSOFT AND/OR ITS SUPPLIERS MAKE NO REPRESENTATIONS OR WARRANTIES ABOUT THE SUITABILITY, RELIABILITY OR ACCURACY OF THE INFORMATION CONTAINED IN THE DOCUMENTS AND RELATED GRAPHICS PUBLISHED ON THIS WEBSITE (THE “MATERIALS”) FOR ANY PURPOSE. THE MATERIALS MAY INCLUDE TECHNICAL INACCURACIES OR TYPOGRAPHICAL ERRORS AND MAY BE REVISED AT ANY TIME WITHOUT NOTICE.

TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, MICROSOFT AND/OR ITS SUPPLIERS DISCLAIM AND EXCLUDE ALL REPRESENTATIONS, WARRANTIES, AND CONDITIONS WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING BUT NOT LIMITED TO REPRESENTATIONS, WARRANTIES, OR CONDITIONS OF TITLE, NON INFRINGEMENT, SATISFACTORY CONDITION OR QUALITY, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, WITH RESPECT TO THE MATERIALS.

APPLIES TO
  • Microsoft Visual Studio Team System 2008 Team Foundation Server
  • Microsoft Visual Studio 2005 Team Foundation Server
  • Microsoft Visual Studio 2005 Team Suite
  • Microsoft Visual Studio Team System 2008 Team Suite
Keywords: 
kbnomt kbrapidpub KB949476