E.1 Solution Files

For every solution, VS.NET creates two files: <solutionname>.sln and <solutionname>.suo. The .sln file is a text file that contains all of the project and solution item information, as well as all of the properties that apply to all the projects in a solution.

The .suo file is a binary file that contains per-user information that has no effect on how projects are built. It keeps track of IDE settings such as the list of windows you currently have open, the locations of your breakpoints, and the project that will be launched when you start debugging the solution. Information in the .suo file is essentially dispensable, because it has precisely no effect on the build output. Since .suo files are not easily editable and contain nothing of lasting consequence, the .suo file format will not be documented here. However, the terminally curious may be interested to know that .suo files are based around COM structured storage and can be opened in the DocFile viewer that ships with the Windows Platform SDK.

E.1.1 .sln file

Each .sln file begins with the following header:

Microsoft Visual Studio Solution File, Format Version 8.00

(The version number will be higher for more recent versions8.00 is the version used by Visual Studio .NET 2003. VS.NET 2002 used 7.00.) This is followed by the project sections:

Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "InBetween",

"InBetween.csproj", "{FF8A9B86-1B01-42A8-816B-A8EE2E8B2057}"

    ProjectSection(ProjectDependencies) = postProject

    EndProjectSectionEndProject

Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CardLibrary", "..\CardLibrary\

CardLibrary.csproj", "{8E615625-7709-4677-A39B-C14C67089D3C}"

    ProjectSection(ProjectDependencies) = postProject

    EndProjectSectionEndProject

EndProject

Each project in the solution has its own Project/EndProject tag section. The Project tag's GUID indicates what kind of projectthe GUID in this example signifies a C# project. (This GUID is used to work out which Project Package VS.NET should load in order to manage this type of project.[1] See Chapter 10 for more information on Project Packages.) After the equals sign is the name of the project, then the relative path from the solution file to the project file. The third item after the equals sign is the project GUID, which is a unique identifier for the project. (A project GUID is generated for each new project you create.)

[1] These GUIDS live in the registry at HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\7.1\Projects.

All projects contain a ProjectSection called ProjectDependencies. This contains any explicit dependencies between the projects. (Implicit dependencies inferred from project references will not be stored hereproject references are stored in the project files, not the solution.) A project with an explicit dependency on another looks like this:

Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ConsoleApplication1",

"ConsoleApplication1\ConsoleApplication1.csproj",

"{4871AAA0-DE72-449B-A25D-B39B9A80FE1B}"

 ProjectSection(ProjectDependencies) = postProject

  {89AC25CD-AA1D-4F08-8AAE-4ED052C716CA} = {89AC25CD-AA1D-4F08-8AAE-4ED052C716CA}

 EndProjectSection

EndProject

In VS.NET 2002, project dependencies were not stored as project sectionsthey were all listed in a global section.

The next item in the file is a section marked with Global and EndGlobal markers. This section contains a series of GlobalSection/EndGlobalSection tags. The syntax of these sections is:

GlobalSection(<sectionname>) = <preSolution|postSolution> 

    <settings go here>

EndGlobalSection

If one or more of your projects is under source control, a global section called SourceCodeControl will be present. This section contains the information that VS.NET requires to check projects in and out of the source control database. See Appendix D for more information about using source control in VS.NET.

All solution files contain a global section called SolutionConfiguration, which looks like this:

GlobalSection(SolutionConfiguration) = preSolution

    Debug = Debug

    Debug = Release

EndGlobalSection

This section simply contains a list of solution configurations. It is followed by the ProjectConfiguration global section, which determines which project configurations will be built in any particular solution configuration.

For VS.NET 2002 files, the ProjectDependencies global section is next. (As of VS.NET 2003, this information is stored in project sections instead, as described earlier.)

GlobalSection(ProjectDependencies) = postSolution

{3C3CF2F4-AD9A-42E0-82BA-32293ADC0756}.0 = {F068A500-1332-4918-9D78-A42FF13C7FC4}

EndGlobalSection

The final two sections are for the benefit of add-ins. (See Chapter 8 for more information about VS.NET add-ins.) The ExtensibilityGlobals section provides add-ins with a place to store solution-wide information. The ExtensibilityAddins section contains a list of add-ins that are in use with this solution.

GlobalSection(ExtensibilityGlobals) = postSolution

EndGlobalSection

GlobalSection(ExtensibilityAddIns) = postSolution

EndGlobalSection