concept solution file in category .net

appears as: solution file, solution files
Continuous Integration in .NET

This is an excerpt from Manning's book Continuous Integration in .NET.

Consider organizing your project directory a little better than the Visual Studio defaults. If you create a project, you’ll get a solution file named after the project. Visual Studio will also create a directory under the solution file, again named after the project, and place the project file inside. That may be all right for a quick shot, but you should consider taking this structure under your control.

MSBuild integrates with Visual Studio solution files, but the integration looks different than it does with project files. MSBuild knows how to execute the solution files, as you’ll see next.

You can use the leasing calculator from chapter 1 as a test field. Your goal is to compile the solution without using Visual Studio. To do that, you’ll need an MSBuild script. The easiest approach is to place it in the same folder as the solution file and make it a solution item (see figure 3.10). The Solution Items folder in Solution Explorer is created if you add any file directly to the solution. Create a text file, and name it build.proj. It helps to name the build scripts the same way in every solution (you’ll learn why in the next section).

Figure 3.10. Custom build script as a solution item in Solution Explorer

To perform clean and rebuild operations on the solution, you must provide the Targets attribute to the MSBuild task. The targets are analogous to the action that Visual Studio performs when you choose Clean Solution and Rebuild Solution from the solution’s context menu in Solution Explorer. The other attribute is the name of the solution file on which the MSBuild project file is to perform the targets. Here’s the code: