Search code examples
.netantbuildbuild-automationnant

Is there a NAnt task that will display all property name / values?


Is there a NAnt task that will echo out all property names and values that are currently set during a build? Something equivalent to the Ant echoproperties task maybe?


Solution

  • Try this snippet:

    <project>
        <property name="foo" value="bar"/>
        <property name="fiz" value="buz"/>
    
        <script language="C#" prefix="util" >
            <code>
                <![CDATA[
                public static void ScriptMain(Project project) 
                {
                    foreach (DictionaryEntry entry in project.Properties)
                    {
                        Console.WriteLine("{0}={1}", entry.Key, entry.Value);
                    }
                }
                ]]>
            </code>
        </script>
    </project>
    

    You can just save and run with nant.

    And no, there isn't a task or function to do this for you already.