Path issues related to branching

Nov 26, 2013 at 6:21 PM
I am completely new to branching. I've done some research, which mainly consisted of reading the Branching and Merging Guide and reading several threads in this forum. After that I decided that my team would probably best be served with a Basic plan, since we only write in-house software and are in complete control of the installation process. (I.e., we don't need hotfixes or service packs; we can just recompile an installation package and uninstall/reinstall.)

I set up a virtual machine to test with and got TFS installed with very little difficulty (yay). Then I tried to duplicate the setup of the existing project that I want to branch. I followed the suggested advice of creating new folders to hold the branches and then I moved my Source folder into the MAIN folder, so now I have /Main/MAIN (with MAIN being converted to a branch) and /Development/DEV (MAIN branched to DEV). We have a top-level folder in the project where we store all our non-project references, i.e., assemblies that are very mature and which we reference as files instead of as projects. The addition of two new levels of folders means I have to update the relative references in my projects to go up an additional two levels. That's not really a problem; I'm not afraid of doing a little direct file manipulation to projects, and it only has to be done once.

What does worry me, though, is that the projects contain relative references to their source control location which INCLUDE their current paths. This is hard to explain, so let me give an example. First, when I opened to solution in MAIN, Visual Studio complained that the source control references in the projects didn't appear to be correct. This is because the projects contained entries that looked like this:

<SccProjectName>%24/MyTFSProject/Source/MyProject1</SccProjectName>

But MyProject1 is no longer at that path; Visual Studio updated the tag to

<SccProjectName>%24/MyTFSProject/Main/MAIN/Source/MyProject1</SccProjectName>

Fine, now it knows where the project is. But then I branched MAIN to DEV. The project file was copied to the DEV file structure, and now when I open the solution from the dev hierarchy, Visual Studio again detects the discrepancy and updates the project file to this:

<SccProjectName>%24/MyTFSProject/Development/DEV/Source/MyProject1</SccProjectName>

This would be fine IF I were never going to change the project again. But we all know projects change. New classes get added (or removed) and perhaps new references are added. So if I make such a change in DEV, when I merge back (RI) into MAIN, that path is going to come right along, and then if I go to open the solution from MAIN (for building or whatnot), Visual Studio will once again complain, fix the path, and then that change will get FI'd to DEV, etc., etc. Is there any way around this?

Maybe this sort of thing isn't an issue for developers who only ever work in the DEV branch, but I'm the guy who's going to be touching all the branches at some point, and I forsee this being a problem. A problem that none of the guides or threads I've read have mentioned at all, so either I'm doing something wrong or people just aren't talking about this.
May 26, 2014 at 3:26 PM
Hi Pawprint,

Did you find any information since to help you with this issue as I've also noted the same issue?

Thanks in advance!
May 26, 2014 at 4:09 PM
Edited May 28, 2014 at 10:32 AM
Hi Pawprint,

I believe I have found a Solution to the problem you have been experiencing! The following worked for me....

Each solution/project within each respective branch needs to have a number of project configuration settings (including the SccProjectName setting) updated to contain the value 'SAK'.

There are two approaches on how you can make this change. Firstly I'll outline the recommended approach:
APPROACH 1:
  1. Open the Solution within Visual Studio.
  2. Click on "File" (menu) -> "Source Control" -> "Change Source Control..." (sub-menu option)
  3. Within the "Change Source Control" dialog select each solution/project in turn and click on the Unbind option for each.
  4. Once you have unbounded all solutions/projects click OK to close the dialog.
  5. Next, repeat step 2 above.
  6. This time within the "Change Source Control" dialog click on the Bind option for each solution/project listed.
  7. Once you have re-bound all solutions/projects click OK to close the dialog (ensure to check out any files you are prompted to check-out).
  8. Save your changes and do a source control compare on one of the projects that you experienced the issue with
Expected Results: - You should now see the following project configuration settings updated similar to as noted below.
    <SccProjectName>SAK</SccProjectName>
    <SccProvider>SAK</SccProvider>
    <SccAuxPath>SAK</SccAuxPath>
    <SccLocalPath>SAK</SccLocalPath>
APPROACH 2:
Alternatively, you can achieve the same result by manually updating each affected project file but making the code changes noted above (i.e. update the value of each configuration setting to be 'SAK'). Ensure to checkout your project files in advance thought for each code branch!

Finally, this solved the issue for me so I hope this is also of help to you or anybody else who experiences the same issue.

Good luck!