Search code examples
antnant

NAnt equvalent of <propertyfile> element


What will be the NAnt equivalent of the below script? This script is in Ant.

<target name="getVersion">
    <propertyfile file="./version.properties">
        <entry key="version" type="string" value="${buildVersion}"/>
    </propertyfile>
</target>

Solution

  • Use the <include> task. The documentation is here. The contents of the include file should be in the form of xml not value pairs as in java. For example

    <?xml version="1.0"?>
    <project name="Project Properties" default="">
      <property name="dotnet-version" value="C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\"/>  
      <property name="output-dir" value="c:\working\testproj\out"/>
      <property name="temp-dir" value="C:\temp"/>
    </project>