Visual Studio Solutions and Branches

If you are having a problem using Vault, post a message here.

Moderator: SourceGear

Post Reply
davenptl
Posts: 9
Joined: Mon Jan 31, 2011 2:23 pm

Visual Studio Solutions and Branches

Post by davenptl » Wed Feb 09, 2011 5:01 pm

It is currently my understanding that solutions won't merge across different branches.

Assuming that I have three branches, Development, Staging and Production would I have to create and manage the same solutions in each branch because solutions contain specific information related to its projects location in source control?

Additionally for example when adding a new project under a solution in the development branch or alternatively creating a new solution in the development branch would I have to then go off and make those same changes (adding/solution creation) in the staging branches manually once I've checked in the solution files and merged the development branch back into the staging branch?

Thanks,

Daven Patel

lbauer
Posts: 9736
Joined: Tue Dec 16, 2003 1:25 pm
Location: SourceGear

Re: Visual Studio Solutions and Branches

Post by lbauer » Thu Feb 10, 2011 9:26 am

It is currently my understanding that solutions won't merge across different branches.
Is there somewhere on our forums where you read this? There may be special cases where someone ran into this.
If you added a new project to a solution, you should be able to merge it into its trunk or branch.

Are you trying to merge solutions or solution files? What kinds of problems/errors have you run into?
Linda Bauer
SourceGear
Technical Support Manager

Beth
Posts: 8550
Joined: Wed Jun 21, 2006 8:24 pm
Location: SourceGear
Contact:

Re: Visual Studio Solutions and Branches

Post by Beth » Thu Feb 10, 2011 9:42 am

You won't need to worry about the .sln not being mergeable.

You will branch, then perform a fresh Open from Vault (or Open from Source Control) on the branch. Do whatever you need to the branch, including adding additional projects and check in your changes. Then close Visual Studio and perform the merge branches. Your .sln file will be listed as not mergeable. That's ok. Just continue through the merge and ignore the .sln file. When finished, check in your merged changes.

After the merge, go to your original location and perform a Get to get the new projects to disk. Then open your original project in VS using either recent links or double-clicking on the solution file on disk. You will be asked if you want to load the added project. Just say yes and VS will take care of the rest.

If you would like to run a test before trying it on your live project, you could use your Vault client and connect to our demo server if you are on the latest version. Information on our demo server can be found here: http://www.sourcegear.com/vault/demo.html. There's already some test projects in the Main repository that you can play with, or you can create your own test project and add it.
Beth Kieler
SourceGear Technical Support

davenptl
Posts: 9
Joined: Mon Jan 31, 2011 2:23 pm

Re: Visual Studio Solutions and Branches

Post by davenptl » Thu Feb 10, 2011 9:50 am

I just finished running a merge operation between the development and staging branch.

After looking at the file the solution file in the staging branch is still pointing to the projects contained in the development branch which means any work done on the solution contained within the staging branch would be done on code in the develpment branch.

Given this because the solutions are supposed to be pointing to projects within their respective branches would I have to create a similar solution in the staging branch so it references the staging projects instead of the development projects.

Beth
Posts: 8550
Joined: Wed Jun 21, 2006 8:24 pm
Location: SourceGear
Contact:

Re: Visual Studio Solutions and Branches

Post by Beth » Thu Feb 10, 2011 10:38 am

When I ran a test, I didn't get the same behavior.

Would you be willing for me to take a closer look at what is going on in your case? If so, could you send an email to support at sourcegear.com (attn: Beth) with a link to this forum thread?
Beth Kieler
SourceGear Technical Support

Beth
Posts: 8550
Joined: Wed Jun 21, 2006 8:24 pm
Location: SourceGear
Contact:

Re: Visual Studio Solutions and Branches

Post by Beth » Thu Feb 10, 2011 2:00 pm

For other users who might read this, here's what needs to happen when you branch a bound project.

1) Close VS.
2) Use the Vault GUI client to create the branch. You can allow the .sln to be branched.
3) Once the branch is checked in, open VS.
4) Go to File - Source Control - Open from Source Control (or Open from Vault).
5) Follow the wizard to open the branched project. It needs to be in a different folder than the original project.
6) The branch is now bound separate from the original project.

If the branched project fails to be opened this way the first time it is opened, it will use the old bindings. Each user needs to perform this the first time they open a project on their machine.

HS: 222331
Beth Kieler
SourceGear Technical Support

CesarGon
Posts: 15
Joined: Thu Mar 06, 2008 4:45 am
Location: Spain

Re: Visual Studio Solutions and Branches

Post by CesarGon » Wed Jun 29, 2011 4:55 am

Beth (and all),

I am under the same stuation as davenptl. I opened the branched solution from Vault (step 4 in your list) within Visual Studio, and as soon as the files loaded in the Solution Explorer, I could see that they corresponded to the trunk version of my project rather than the branch. I verified this when I opened them.

I looked at the bindings and I saw they pointed to the trunk (!!). I rebound to the branch and worked away for a while. When, later, I opened the trunk version, the bindings were pointed to the branch too. I got the impression that Vault mixes up the trunk and the branch inside Visual Studio.

I posted a question about this yesterday, here: http://support.sourcegear.com/viewtopic.php?f=5&t=16402.
Regards,
Cesar.

Beth
Posts: 8550
Joined: Wed Jun 21, 2006 8:24 pm
Location: SourceGear
Contact:

Re: Visual Studio Solutions and Branches

Post by Beth » Wed Jun 29, 2011 8:51 am

There's a response for you in the other thread you created: http://support.sourcegear.com/viewtopic.php?f=5&t=16402.
Beth Kieler
SourceGear Technical Support

Post Reply