NAnt SDK Documentation - v0.92 |

# SolutionTask Class

Compiles VS.NET solutions (or sets of projects), automatically determining project dependencies from inter-project references.

For a list of all members of this type, see SolutionTask Members.

System.Object
NAnt.Core.Element
NAnt.Core.Task
NAnt.VSNet.Tasks.SolutionTask

[Visual Basic]
<Serializable, _ Serializable, _ PluginConsumer(PluginType:=NAnt.VSNet.Extensibility.ISolutionBuildProvider), _ TaskName(Name:="solution"), _ PluginConsumer(PluginType:=NAnt.VSNet.Extensibility.IProjectBuildProvider)>
Public Class SolutionTask
Inherits Task
Implements IPluginConsumer
[C#]
[Serializable]
[Serializable]
[PluginConsumer(PluginType=NAnt.VSNet.Extensibility.ISolutionBuildProvider)]
[TaskName(Name="solution")]
[PluginConsumer(PluginType=NAnt.VSNet.Extensibility.IProjectBuildProvider)]
public class SolutionTask : Task, IPluginConsumer

#### Thread Safety

Public static (Shared in Visual Basic) members of this type are safe for multithreaded operations. Instance members are not guaranteed to be thread-safe.

#### Remarks

This task support the following projects:

- Visual Basic .NET
- Visual C# .NET
- Visual J# .NET
- Visual C++ .NET

> Note Right now, only Microsoft Visual Studio .NET 2002 and 2003 solutions and projects are supported. Support for .NET Compact Framework projects is also not available at this time.

The SolutionTask also supports the model of referencing projects by their output filenames, rather than referencing them inside the solution. It will automatically detect the existance of a file reference and convert it to a project reference. For example, if project "A" references the file in the release output directory of project "B", the SolutionTask will automatically convert this to a project dependency on project "B" and will reference the appropriate configuration output directory at the final build time (ie: reference the debug version of "B" if the solution is built as debug).

> Note The SolutionTask expects all project files to be valid XML files.

### Resx Files

When building a project for a down-level target framework, special care should be given to resx files. Resx files (can) contain references to a specific version of CLR types, and as such are only upward compatible.

For example: if you want to be able to build a project both as a .NET 1.0 and .NET 1.1 assembly, the resx files should only contain references to .NET 1.0 CLR types. Failure to do this may result in a InvalidCastException failure at runtime on machines with only the .NET Framework 1.0 installed.

#### Example

Compiles all of the projects in `test.sln`, in release mode, in the proper order.

    <solution configuration="release" solutionfile="test.sln" />

Compiles all of the projects in `projects.txt`, in the proper order.

    <solution configuration="release">
        <projects>
            <includesfile name="projects.txt" />
       </projects>
    </solution>

Compiles projects A, B and C, using the output of project X as a reference.

    <solution configuration="release">
        <projects>
            <include name="A\A.csproj" />
            <include name="B\b.vbproj" />
            <include name="C\c.csproj" />
        </projects>
        <referenceprojects>
            <include name="X\x.csproj" />
        </referenceprojects>
    </solution>

Compiles all of the projects in the solution except for project A.

    <solution solutionfile="test.sln" configuration="release">
        <excludeprojects>
            <include name="A\A.csproj" />
        </excludeprojects>
    </solution>

Compiles all of the projects in the solution mapping the specific project at http://localhost/A/A.csproj to c:\inetpub\wwwroot\A\A.csproj and any URLs under http://localhost/B/[remainder] to c:\other\B\[remainder]. This allows the build to work without WebDAV.

    <solution solutionfile="test.sln" configuration="release">
        <webmap>
            <map url="http://localhost/A/A.csproj" path="c:\inetpub\wwwroot\A\A.csproj" />
            <map url="http://localhost/B" path="c:\other\B" />
        </webmap>
    </solution>

Compiles all of the projects in the solution placing compiled outputs in `c:\temp`.

    <solution solutionfile="test.sln" configuration="release" outputdir="c:\temp" />

#### Requirements

Namespace: NAnt.VSNet.Tasks

Assembly: NAnt.VSNetTasks (in NAnt.VSNetTasks.dll)

#### See Also

SolutionTask Members | NAnt.VSNet.Tasks Namespace