How to get the Target name that is current been processed

I want to know how I can get the Target name value that the Excecute method is executing.

Answer this question

How to get the Target name that is current been processed

  • Rob S

    Thanks for the reply,

    The reason I need to get the task name within the task is so when I raise an exception I can write the task name that was executed, this information can also be written to the eventlog as well.


  • Martin R

    Hi,
    I don't think you can get this value directly. I would imagine that was by design. But if you really need it I imagine you could use the BuildEngine.ProjectFileOfTaskNode to get the location of the project file, and read the target tag that contains the task located at BuildEngine.LineNumberOfTaskNode and extract the name.
    Why do you need this value

    Sayed Ibrahim Hashimi
    www.sedodream.com

  • ZeeGee

    Task should not need information about target that is executing it. Logging should be done by loggers. Loggers gets information about tasks, targets, everything. If problem can't be solved by logging using TaskLoggingHelper functions you must do a separate logger.

  • How to get the Target name that is current been processed