I have developed a task that I would like to offer up as a contribution
to NAnt.  The "copyProject" task is designed to take the compiled output
of a VS.NET project and copy it to another location.  For example:

<copyProject projectFile="test.csproj" configuration="Release"
destinationFolder="C:\Program Files\test" />

Although this isn't terribly exciting for most projects, for ASP.NET
projects it copies the compiled assemblies AND all of the files marked
as "content."  Basically, it does what the "Copy Project" menu option in
VS.NET does for web projects other than setting directory permissions.

We've been using this task for several months now, and it has been
working quite well for us.  It was originally written in VB.NET, but I
converted it to C# before sending it in this e-mail.

Unfortunately, it only 95% ready for inclusion into NAnt if you decide
to accept it.  The reason is this: as originally written, it used its
own implementation of a Project class.  (My original VB.NET code for
this class and a related XSD are attached for reference, NOT to be
considered for inclusion in NAnt.)  However, many of the things I needed
are also in the existing ProjectBase class as used by the "solution"
task.  It makes sense to me that with some refactoring, the existing
ProjectBase class could potentially be used by both tasks.  There are
three areas of code where stuff is commented out and marked with "TODOs"
where my version of Project had worked before but the existing NAnt
ProjectBase class is different.  This was only to prevent compiler
errors as I converted the code to C# within the NAnt.VSNet project.

A second option would be for me to convert my original Project class to
C# with another name, though I think this should only be considered a
short-term solution.

So what do you think?  Would you want to include this task?

Attachment: CopyProjectTask.cs
Description: CopyProjectTask.cs

Attachment: Project.vb
Description: Project.vb

Attachment: ProjectFile.xsd
Description: ProjectFile.xsd

Reply via email to