midnight_car on Sat, 17 Nov 2012 22:30:20
In a C# 2008 application that I amn working with there are two different solution files that are connected together. There is a smaller solution file called 'sample'. There is another solution file I will call the 'main' solution file. The 'main' solution file contains 3 project files plus the other solution file called sample.
Due to the statement I listed above with the 2 different solution files, I have the following questions:
1. When I am working with the 'main' solution file, I was orginally assuming that the 'sample' project code that I am looking at was the code in the 'sample' solution file. However when I was debugging this application this week, I found out that this is not true since the code is different. I found out that the code is different when looking at the auto generated code setup by the linq to sql designer. I was 'stepping through code' and I found out there was a difference.
Thus is there a way to make the 'sample' project code file be the same that is in the 'main' project file? If so, how would you accomplish this goal?
2. I need to check this code into version control software called team server foundation or subversion. I want to make certain that only the code in the 'sample' project folder is checked into the version control software. I do not want the 'extra' sample project file that is appears in the 'main' solution file to appear. Can you tell me how you would solve this issue?
CoolDadTx on Sun, 18 Nov 2012 21:38:59
Solution files are nothing more than groupings of project files. You can have any # of projects in a single solution and projects can reside in different solution files. The solution file contains only a minimal amount of information such as the build order and what projects (and configurations/platforms) to build for each solution configuration/platform. Everything else is per-project. Note that there is no such thing as a solution within a solution. Solutions hold project files and that is it. Of course you can set up a solution folder to hold any type of file you want but irrelevant of whether you put solution files in their you still only have one solution open at a time.
If you have multiple solutions with the same projects then you'll want to keep the solutions in the same directory. Note that VS, by default, keeps each solution in separate directories so you'll want to copy the solution files to the same directory. You can then open either one.
1) Solutions are just groupings of projects. Look in your Sample solution and see where it is pointing to the project you want. Then load that same project into your Main solution.
2) Source control varies wildly so how you check stuff in is completely dependent upon your SC provider. I recommend that you check in your Main solution with all the projects of interest. Then you can open your Samples solution and check that solution in. Since the projects are already in source control they won't be checked in again.
Please refer to MSDN on what a solution really is and how it relates to projects. Based upon your description I don't see the need for 2 solution files. In almost all cases a single solution file is sufficient. The only time you start breaking things into multiple solutions is when the codebase is so large as to warrant separation or when separate teams are working on different portions of the same code. In all other cases you will gain nothing by using multiple solutions.
Michael Taylor - 11/18/2012