Hi Kevin,

> I would like to know the target passed as a command-line argument to the nAnt
> command and use it to as a variable before any of the tasks in my build file
> are called.

Well, there's target::get-current-target() but you've probably
already seen this.

I ended up writing a custom function to grab all of them,
it feels dirty but does the job:

/// <summary>
/// Get build targets called
/// </summary>
/// <returns>Comma separated list of build targets</returns>
[Function("get-build-targets")]
public string GetBuildTargets()
{
    String[] targets = new String[Project.BuildTargets.Count];

    Project.BuildTargets.CopyTo(targets, 0);

    return String.Join(", ", targets);
}

peace
si


-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid3432&bid#0486&dat1642
_______________________________________________
NAnt-users mailing list
NAnt-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nant-users

Reply via email to