Properties specified on the command line are read-only. When NAnt sees
your property line it tries to set it and it can't because it is already
read-only. Use a guard to make sure that it is executed only if the
property does not exist. Example:

<?xml version="1.0"?>
<project name="Test">
   <property name="config" value="Release"
unless="${property::exists('config')}" />
</project>

Notice I used single quotes to specify the property name. If you fail to
use single quotes then NAnt will try to evaluate config and you'll
likely get errors at some point.

--Edwin

> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:nant-users-
> [EMAIL PROTECTED] On Behalf Of Craig Wagner
> Sent: Friday, November 19, 2004 4:48 PM
> To: [EMAIL PROTECTED]
> Subject: [Nant-users] Overwriting properties
> 
> I'm sure this is something stupid, but I can't figure out how to
> overwrite a property from the command-line.
> 
> I've got a simple build file.
> 
> <?xml version="1.0"?>
> <project name="Test">
>     <property name="config" value="Release" readonly="false" />
> </project>
> 
> I run it from the command-line as follows:
> 
> nant -D:config=Debug
> 
> It always gives me an error:
> 
> NAnt 0.85 (Build 0.85.1783.0; nightly; 11/18/2004)
> Copyright (C) 2001-2004 Gerry Shaw
> http://nant.sourceforge.net
> 
> Buildfile: file:///C:/VSSLocal/Applications/Products/test.build
> 
>  [property] Read-only property "config" cannot be overwritten.
> 
> BUILD SUCCEEDED - 0 non-fatal error(s), 1 warning(s)
> 
> Total time: 0 seconds.
> 
> What the heck am I doing wrong?
> 
> ---
> Craig Wagner
> 
> 
> -------------------------------------------------------
> This SF.Net email is sponsored by: InterSystems CACHE
> FREE OODBMS DOWNLOAD - A multidimensional database that combines
> robust object and relational technologies, making it a perfect match
> for Java, C++,COM, XML, ODBC and JDBC. www.intersystems.com/match8
> _______________________________________________
> Nant-users mailing list
> [EMAIL PROTECTED]
> https://lists.sourceforge.net/lists/listinfo/nant-users


-------------------------------------------------------
This SF.Net email is sponsored by: InterSystems CACHE
FREE OODBMS DOWNLOAD - A multidimensional database that combines
robust object and relational technologies, making it a perfect match
for Java, C++,COM, XML, ODBC and JDBC. www.intersystems.com/match8
_______________________________________________
Nant-users mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/nant-users

Reply via email to