I like the idea. See what others say and then we can look at adding it. Your approach looks pretty much correct. Don't know why you can't build though.
Ian
-- Part 1 -- Hi NAnters,
I was just editing some build files and testing out some things. The thought occurred to me that certain tasks don't have as useful a message output as would sometimes be desired. Take the following task:
<delete dir="c:\winnt" />
The typical output is:
[delete] Deleting 1 directories.
Wouldn't it be handy to be able to do this:
<delete dir="c:\winnt" message="Deleting windows!!" />
...and get this...
[delete] Task Message: Deleting windows!! [delete] Deleting 1 directories.
...or some variation on this.
Now before someone says "Just use <ECHO>!", let me point out that this would be applicable to the task itself such that it's also affected by task conditions:
<delete dir="c:\winnt" message="Deleting windows!!" if="${meNotTooBright}" />
Not to mention that adding this one attribute to the task base class would be remarkably easy and thus globally available.
-- Part 2 -- So I tried my hand at adding a "message" attribute to the Task class (using the 0.8.3-rc2 code) but I failed miserably. I'm not C#-enough (Get it? Sorry.) to figure out why it won't build (all kinds of reference errors which I can't seem to track down). So I figured I'd throw this up so that someone important who feels it's a good enough idea can put it in and make it actually work!
Modifications to the Task base class (Task.cs):
Added this var and property:
string _message;
/// <summary> /// Task specific message that is echoed if the task is executed. Default is blank. /// </summary> [TaskAttribute("message")] public string Message { get { return _message; } set { _message = value; } }
Jammed this into public void Execute() right before ExecuteTask(); (approx line 145 in the code I had):
if(_message != null){ Log(Level.Info, LogPrefix + "Task Message: " + _message); }
This is only a suggestion. If someone actually DOES make this addition, feel free to make the log message show appropriately according to NAnt standards etc. Doesn't really matter to me what it looks like, just that a message is shown and obviously associated with the task.
Thanks!
Peter
-------------------------------------------------------
This SF.Net email sponsored by: Free pre-built ASP.NET sites including
Data Reports, E-commerce, Portals, and Forums are available now.
Download today and enter to win an XBOX or Visual Studio .NET.
http://aspnet.click-url.com/go/psa00100003ave/direct;at.aspnet_072303_01/01
_______________________________________________
Nant-users mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/nant-users
------------------------------------------------------- This SF.Net email sponsored by: Free pre-built ASP.NET sites including Data Reports, E-commerce, Portals, and Forums are available now. Download today and enter to win an XBOX or Visual Studio .NET. http://aspnet.click-url.com/go/psa00100003ave/direct;at.aspnet_072303_01/01 _______________________________________________ Nant-users mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/nant-users