We are in the process of trying to implement perforce in our small IT department. We’re primarily developing in .net using visual studio 2008. I’ve organized my projects as follows:
Customer
Product
main_line
version_1
version_2
Libraries
Library_Name
main_line
version_1
A main_line/version folders contain the solution file as well as the code files for the main project in the solution. The solution typically includes one or more projects contained in the “Libraries” hierarchy, and those library projects are usually included in multiple solutions. In perforce this seems to work fine as long as I apply source control to individual projects as opposed to entire solutions. In fact, either the perforce plug-in, or visual studio itself, gives me a warning if I try to source control solutions that share common projects/libraries.
The problems start happening when I try to branch solutions. Since I’m not source controlling the entire solution, the .sln file is not copied to the branch directory, which I suspect is would be useless anyway due to incorrect file mappings. My question is, am I doing something wrong or is branching of visual studio solutions always this painful? Is there a better way? Perforce seems work well only for simple solutions. Is there a source control product that works better with visual studio?
I managed to get this worked out pretty well. What seemed to cause a problem for me was having my solution file (.sln) in the same directory as the code for my start-up/main project. I moved the project code to it’s own sub-folder at one level below the actual solution.
This allowed me to make all of the project references in the sln_file relative. Then I add the code in the src folder to the depot via the visual studio plug-in. I add the projects individually, not the entire solution. The only issue is that I have to manage the sln file through p4v directly, but since it doesn’t change all that often anyway, this isn’t really a problem. Now, when I branch main_line, I get a copy of the .sln file, with relative references, and everything works as expected.