Here's a sample from my build files:
<!-- +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~+ --> <!-- | THE APPLICATION BUILD VERSION | --> <!-- +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~+ --> <!-- | | --> <!-- | If there is no version file then create a new one. | --> <ifnot test="${file::exists(application-scripts-folder-version-file)}"> <property name="application-scripts-folder-version-number" value="0" /> <echo file="${application-scripts-folder-version-file}" message="${application-scripts-folder-version-number}" /> <echo level="Info" message="## Created new application version number file: ${application-scripts-folder-version-file}" /> </ifnot> <!-- | | --> <!-- | Now, update it from the file so that we can use it. | --> <loadfile file="${application-scripts-folder-version-file}" property="application-scripts-folder-version-number" /> <property name="application-scripts-folder-version-number" value="${string::trim(application-scripts-folder-version-number)}" overwrite="true" /> <!-- | And finally report this - it may be useful later. | --> <echo level="Info" message="## application-scripts-folder-version-number = ${application-scripts-folder-version-number}" /> <!-- | | --> <!-- +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~+ --> <!-- +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~+ --> <!-- | INCREMENT APPLICATION BUILD VERSION ID | --> <!-- +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~+ --> <target name="application_increment_global_build_version_number" description="Increments the application build version number."> <!-- | Update it from the file so that we can use it. | --> <loadfile file="${application-scripts-folder-version-file}" property="application-scripts-folder-version-number" /> <property name="application-scripts-folder-version-number" value="${string::trim(application-scripts-folder-version-number)}" overwrite="true" /> <!-- | Update the version number that is being used. | --> <property name="application-scripts-folder-version-number" value="${int::parse(application-scripts-folder-version-number) + 1}" overwrite="true" /> <echo file="${application-scripts-folder-version-file}" message="${application-scripts-folder-version-number}" /> <!-- | Now report the change. | --> <echo level="Info" message="## Global application build version number incremented. New value: ${application-scripts-folder-version-number}" /> </target> -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of Tim Mayert Sent: Thursday, December 15, 2005 2:42 PM To: nant-users@lists.sourceforge.net Subject: [NAnt-users] Automatically updating build number on nightly builds We are just looking at implementing our major builds in NAnt for nightly builds and would like to know if there are simple function(s) that will automatically update our build number for each build. At the moment we have the build number set in our project ProjectProperties.xml file, shown below, that is loading in the include section of our main default.build file. <?xml version="1.0" encoding="utf-8" ?> <project name="ProjectProperties" default="build" xmlns="http://nant.sf.net/release/0.85-rc3/nant.xsd"> <!-- This file should contain all the properties specific to your project !--> <!-- Set these properties for product version and source label/tag. !--> <property name="MAJORNUM" value="1" /> <property name="MINORNUM" value="2" /> <property name="BUILDNUM" value="28" /> <property name="PATCHNUM" value="0" /> <property name="VERSION" value="${MAJORNUM}.${MINORNUM}.${BUILDNUM}.${PATCHNUM}" /> At the moment this file is manually updated for each build, which is not an issue until we go to nightly builds. At that point we would have to remember to update the BUILDNUM every night before going home so that the build gets the correct build number. So I am looking for a way to have the BUILDNUM incremented by 1 for every build before the file gets loaded by the main build file. Now my experience with NAnt is still at a beginners state and therefore I do not know all the in's and out's of it as of yet. So if someone could suggest a simple way to have this one file automatically updated before it gets loaded so the new build will reflect the updated build number then I would appreciate that. Examples and suggestions are welcome...... Thanks, Tim Mayert. ------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Do you grep through log files for problems? Stop! Download the new AJAX search engine that makes searching your log files as easy as surfing the web. DOWNLOAD SPLUNK! http://ads.osdn.com/?ad_idv37&alloc_id865&op=click _______________________________________________ NAnt-users mailing list NAnt-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/nant-users ============================================================================== Please access the attached hyperlink for an important electronic communications disclaimer: http://www.csfb.com/legal_terms/disclaimer_external_email.shtml ============================================================================== ------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Do you grep through log files for problems? Stop! Download the new AJAX search engine that makes searching your log files as easy as surfing the web. DOWNLOAD SPLUNK! http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click _______________________________________________ NAnt-users mailing list NAnt-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/nant-users