tags:

views:

117

answers:

1

I am just starting to pick up NAnt as a replacement for MSBuild in our CruiseControl project.

One of the things we do inside a set of projects is link in a single AssemblyInfo.cs file from outside of the project tree to make versioning easier (it lives in a directory above the project folders).

Is there an obvious way of achieving this in the <sources> section of the <csc> task?

From what I can tell, the <sources> section only supports a single <include> element, which must be underneath the basedir of the task.

I suppose another option would be to copy the single AssemblyInfo.cs file as part of the task prior to calling csc, but wondered whether there was a cleaner way of doing this.

+1  A: 

You are not limited to a single <include/> in <sources/>. You can reference whatever you want if you don't specift the basedir property of <sources/>:

<csc target="exe" output="HelloWorld.exe" debug="true">
    <sources>
        <!-- Will use project dir as base dir -->
        <include name="**/*.cs" />
        <!-- Absolute path -->
        <include name="/tmp/42/*.cs" />
        <!-- Relative to project dir -->
        <include name="../../Shared/*.cs" />
    </sources>
    <references>
        <include name="System.dll" />
        <include name="System.Data.dll" />
    </references>
</csc>
Laurent Etiemble
Great - that works, thanks.
matt