Wednesday, July 06, 2005

Handy NAnt Target

NAnt's -projecthelp option only shows targets in or whatever you've named your initial build file. Targets in included files don't get shown. Here's a helpful widget using NAnt's "script" capability to write a C# function. Paste this into your common or core build file and you'll have the ability to see all targets in your merged build files. I can't take credit for this -- I found this snippet a year or more ago somewhere on the web, perhaps on the NANT-USER mailing list. I don't recall who wrote it, but here's a virtual beer mug raised in your direction. <!-- 'nant -projecthelp' shows only targets in, not in included files --> <target name="showtargets" description="Show targets in all included build files">    <script language="C#">       <code><![CDATA[          public static void ScriptMain(Project project) {             foreach( Target t in project.Targets ){                Console.WriteLine( t.Name + ":\n\t " + t.Description);             }          }       ]]></code>    </script> </target>


Anonymous said...


Anonymous said...


Subscribe (RSS)

The Leadership Journey