Alex,

Yes, now I see what is going on.  Modified the script as follows to set a 'default' value in the event it is not specified on the command line as such:

<?xml version="1.0"?>

<project name="TestBuild" default="default" basedir=".">

    <if test="${not property::exists('TestProperty')}" >
        <property name="TestProperty" value="foo" />
    </if>

    <target name="*">

        <echo message="TestProperty = ${TestProperty}" />

    </target>

</project>

This elicits the behavior that I want without the error message.

Thanks,

Ken Parrish


Roebuck, Alex wrote:
This also fooled me for a long time.
 
The message saying "cannot overwrite read-only property" refers to the line in the NAnt build file trying to assign to a property that has been assigned on the command-line, not vice versa.


From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] On Behalf Of Bob Archer
Sent: Monday, March 03, 2008 4:38 PM
To: Martin Gainty; [EMAIL PROTECTED]; nant-users@lists.sourceforge.net
Subject: Re: [NAnt-users] Command line properties - Can you explainthismessage?

That won’t work because a property set on the command line is read-only by design.

 

(Overwrite by default is already set to true anyhow.)

 

BOb

 

 


From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] On Behalf Of Martin Gainty
Sent: Monday, March 03, 2008 11:31 AM
To: [EMAIL PROTECTED]; nant-users@lists.sourceforge.net
Subject: Re: [NAnt-users] Command line properties - Can you explain thismessage?

 

Hi Ken-

1) you'll need to set overwrite attribute to true e.g.

<property name="TestProperty" value="foo" overwrite="true"/>

2)The user MUST HAVE write privileges to the folder in which he is writing
so user fu can overwrite bar.txt

chown fu bar.txt

HTH

Martin-

----- Original Message -----

From: Ken Parrish

Sent: Monday, March 03, 2008 11:06 AM

Subject: [NAnt-users] Command line properties - Can you explain this message?

 

I am setting a property from the command line.  It seems to work, but I get a message indicating that I cannot overwrite the property, yet the property does in fact get set.  Can anyone help explain this?
______________

Nant Script:

<?xml version="1.0"?>

<project name="TestBuild" default="default" basedir=".">

    <property name="TestProperty" value="foo" readonly="false" />

    <target name="*">

        <echo message="TestProperty = ${TestProperty}" />

    </target>
</project>
______________

Command Line:

nant -D:TestProperty=bar
______________

Output:

NAnt 0.85 (Build 0.85.2478.0; release; 10/14/2006)
Copyright (C) 2001-2006 Gerry Shaw
http://nant.sourceforge.net

Buildfile: file:///C:/Gomez/svn/Source/GPNCore/trunk/Applications/test/test.build
Target framework: Microsoft .NET Framework 2.0
Target(s) specified: default

 [property] Read-only property "TestProperty" cannot be overwritten.

default:

     [echo] TestProperty = bar

BUILD SUCCEEDED - 0 non-fatal error(s), 1 warning(s)

Total time: 0 seconds.
______________

Thanks,

Ken Parrish
Gomez, Inc.


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/


_______________________________________________
NAnt-users mailing list
NAnt-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nant-users


------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/

_______________________________________________ NAnt-users mailing list NAnt-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/nant-users




-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
NAnt-users mailing list
NAnt-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nant-users

Reply via email to