NAnt
![]() ![]() ![]() |
v0.91 |
Compiles VS.NET solutions (or sets of projects), automatically determining project dependencies from inter-project references.
This task support the following projects:
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 <solution> task 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 <solution> task 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 <solution> task expects all project files to be valid XML 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.
Attribute | Type | Description | Required |
---|---|---|---|
configuration | string | The name of the solution configuration to build. | True |
enablewebdav | bool | Allow the task to use WebDAV for retrieving/compiling the projects within solution. Use of WebMap is preferred over WebDAV. The default is false. | False |
includevsfolders | bool | Includes Visual Studio search folders in reference search path. The default is true. | False |
outputdir | directory | The directory where compiled targets will be placed. This overrides path settings contained in the solution/project. | False |
platform | string | The name of platform to build the solution for. | False |
solutionfile | file | The name of the VS.NET solution file to build. | False |
failonerror | bool | Determines if task failure stops the build, or is just reported. The default is true. | False |
if | bool | If true then the task will be executed; otherwise, skipped. The default is true. | False |
unless | bool | Opposite of if . If false then the task will be executed; otherwise, skipped. The default is false. |
False |
verbose | bool | Determines whether the task should report detailed build log messages. The default is false. | False |
Represents a single mapping from URL project path to physical project path.
Attribute | Type | Description | Required |
---|---|---|---|
path | file | Specifies the actual path to the project file, or the path fragment to replace. | True |
url | string | Specifies the URL of the project file, or a URL fragment to match. | True |
casesensitive | bool | Specifies whether the mapping is case-sensitive or not. | False |
if | bool | Indicates if the URL of the project file should be mapped. | False |
unless | bool | Indicates if the URL of the project file should not be mapped. | False |
Sets a property in the current project.
Note: NAnt uses a number of predefined properties.
Attribute | Type | Description | Required |
---|---|---|---|
name | string | The name of the NAnt property to set. | True |
value | string | The value to assign to the NAnt property. This attribute's properties will not be automatically expanded! | True |
dynamic | bool | Specifies whether references to other properties should not be expanded when the value of the property is set, but expanded when the property is actually used. By default, properties will be expanded when set. | False |
overwrite | bool | Specifies whether the value of a property should be overwritten if the property already exists (unless the property is read-only). The default is true. | False |
readonly | bool | Specifies whether the property is read-only or not. The default is false. | False |
failonerror | bool | Determines if task failure stops the build, or is just reported. The default is true. | False |
if | bool | If true then the task will be executed; otherwise, skipped. The default is true. | False |
unless | bool | Opposite of if . If false then the task will be executed; otherwise, skipped. The default is false. | False |
verbose | bool | Determines whether the task should report detailed build log messages. The default is false. | False |
Define a debug
property with value true.
<property name="debug" value="true" />
Use the user-defined debug
property.
<property name="trace" value="${debug}" />
Define a read-only property. This is just like passing in the param on the command line.
<property name="do_not_touch_ME" value="hammer" readonly="true" />
Define a property, but do not overwrite the value if the property already exists (eg. it was specified on the command line).
<project name="property-example"> <property name="debug" value="true" overwrite="false" /> <echo message="debug: ${debug}" /> </project>
Executing this build file with the command line option -D:debug=false
, would cause the value specified on the command line to remain unaltered.
[echo] debug: false
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" />