Hi, Niranjan....
 
I did that quite easily with a response file.  Here's a snippet from the batch file I used:
NAnt @myapp.response %*
 
The "@" indicates that myapp.response is a response file.  The extension has no particular meaning, and could even be omitted.
 
The %* added any parms passed to the CMD file when it was exewcuted at the command line.
 
Here are some lines from the response file...just like you indicated.  The "#" indicates a comment line; it isn't parsed.  The other lines follow the NAnt command line requirment:  The "-D" indicates the a property/value pair Note that properties initialized from a respons file will be marked readonly in the NAnt script during execution.

-buildfile:NAnt.build
-l:MyApp.log
 
-D:app.build.number=05.12.08.02
 
#-D:app.asminfo.AssemblyCopyright=2004
#-D:app.asminfo.AssemblyProduct=MyApp
#-D:app.asminfo.AssemblyTrademark=MyCompany
#-D:app.asminfo.CLSCompliant=true
 
#-D:app.bypass.vss=true
#-D:app.bypass.vss.all=true
 
-D:app.file.buildfile=MyApp.build
-D:app.file.properties=MyApp.properties
 
I tired to be more creative with a properties file, not unlike what you tried, but haven't gotten it to work just right.
 
Rod
 
 
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]On Behalf Of Ramya Niranjan
Sent: Monday, June 12, 2006 9:55 PM
To: nant-users@lists.sourceforge.net
Subject: [NAnt-users] Setting property after reading from a file.

Hello All,
 
I have a text file info.txt that contains some version specific information like:
MAJORVERSION=4.0
MINORVERSION=11
BRANCHINFO=COR
 
What I need to do is create some properties like majorversion, minorversion and branchinfo in NAnt and assign these values after reading from the txt file. In short, whenever there is a change in the version or branch value, I should change only this text file and not the build file. Is this possible?
 
I have tried using foreach item=Line in filename property=some value, but this only sets the last value to the property as the previous 2 value get overwritten. Loadfile is also not of much help.
 
Rgds,
Niranjan
_______________________________________________
NAnt-users mailing list
NAnt-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nant-users

Reply via email to