views:

67

answers:

1

I have created an MSBuild tasks for building my projects, but for various reasons I wan't to switch to NAnt.

Is there some task that would be equivalent to MSBuild's XmlMassUpdate in NAnt? If possible I would like to use the same xml replacement file I used with XmlMassUpdate.

(for more info about XmlMassUpdate, here's a short usage I found on stackoverflow's site: MSBuild example)

I tried with xmlPeek/xmlPoke tasks but couldn't get them to iterate a tree paths in a replacement file...

A: 

It turned out that I just need to adjust the code from tigris' implementation into the one that would work for NAnt.

The solution is a bit lengthly so it doesn't make sense to post it here in whole, but these would be the steps...

Tigris MsBuildTasks site has both the binaries and the source code for every task.

Just find the implementation of XmlMassUpdate, see how it's done, and create NAnt task class in your task library, like so:

[TaskName("XmlMassUpdate")]
public class XmlMassUpdate : Task
{
    [TaskAttribute("ContentFile", Required=true)]
    public string ContentFile { get; set; }
    //...
    protected override void ExecuteTask()
    {
        // ...
    }
    //other methods
}

What's rest is to copy your library dll to nant's bin and you can use it... enjoy

veljkoz