Rod,

What version of NAnt are you using ?

This is working just fine here. 

Let me know if its working for you using a recent nightly build
(http://nant.sourceforge.net/nightly/latest).

Gert

> -----Original Message-----
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On Behalf Of Rod Ayers
> Sent: woensdag 16 november 2005 7:59
> To: nant-users@lists.sourceforge.net
> Subject: [Nant-users] Problem with readonly attribute on property
> 
> I have a "top-level" build file in which I initialize several 
> properties.  It then calls a task in another build file <nant 
> .../> that reads a properties file, updating properties 
> previously initialized.  I want to make sure that properties 
> updated from the property file don't get overwritten anywhere 
> in the script, so I tried teh following:
>  
>  
>      <foreach in="${build.file.properties}"
>       item="Line"
>       delim="="
>       property="property.name,property.value"
>       >
>  
>     <!-- property.name must not be empty -->
>       <if test="${property.name > ''}">
>  
>      <!-- property.name must not be a comment -->
>            <if test="${not string::starts-with(property.name, '#')}">
>  
>       <!-- property.value must not be empty -->
>             <if test="${property::exists('property.value')}">
>  
>            <property name="property.name"      
> value="${string::trim(property.name)}"/>
>            <property name="property.value"      
> value="${string::trim(property.value)}"/>
>  
>            <echo message="Adding property = value:         
> ${property.name} = ${property.value}"/>
>            <property name="${property.name}"                  
>  value="${property.value}" readonly="true" />
>         </if>
>  
>        </if>
>  
>       </if>
>  
>    </foreach>
>  
> Everything weorks fine, except the readonly attribute is bein 
> ignored.  I had one property in the property file, 
> build.number.  But, right after the foreach, I was able to 
> set build.number to a different value with another property 
> statement, withouth an error or waraning.
>  
> If I set readonly on the original property statement, any 
> attempt to update the value results in the warning message:  
> Read-only property "build.number" cannot be overwritten.
>  
> Why doesn't readonly="true" work when I change the value of 
> an existing property?
>  
> Thanks,
> Rod
> 



-------------------------------------------------------
This SF.Net email is sponsored by the JBoss Inc.  Get Certified Today
Register for a JBoss Training Course.  Free Certification Exam
for All Training Attendees Through End of 2005. For more info visit:
http://ads.osdn.com/?ad_id=7628&alloc_id=16845&op=click
_______________________________________________
Nant-users mailing list
Nant-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nant-users

Reply via email to