Reputation: 950
I am using nant 0.85 version. I have defined a property in a file and have not specified like'read only=true". But where ever I try to change the value of the property , I get the warning saying that, property cannot be overwritten.
I have tried setting readonly="false" overwrite="true"
.But nothing seems to work. Any help would be greatly appreciated .
Upvotes: 1
Views: 4732
Reputation: 3251
use unless attribute, it works.
<property name="msbuild.path" value="CONFIGURABLE" unless="${property::exists('msbuild.path')}" />
then as usual nant -D:msbuild.path=...
Upvotes: 11
Reputation: 31
You can totally do this in NAnt 0.85. Let's say for example you have a property with the name "myvalue" that you want to be able to be passed in from the command line. You would first define the property in your NAnt script like this:
<property name="myvalue" value="0" overwrite="false" />
When you call NAnt you just need to use the -D parameter to pass in your new value like this:
nant.exe buildfile:myfile.build -logfile:mylog.log -D:myvalue=16
And your new value of "16" will be recognized in your build script which you can test by simply echoing the value like this:
<echo message="myvalue: ${myvalue}" />
For further information you can read the documentation and look at example "iv":
http://nant.sourceforge.net/release/0.85/help/tasks/property.html
Upvotes: 3
Reputation: 301387
Need more details, especially if you "change the value of the property" from command line.
One thing that I have seen that causes some confusion is that when the property is overridden from command line ( -D:prop=value
), and if the same property is defined in the file (<property name="prop" value="value"/>
) it will say read only property cannot be overridden because the property set from command line is read only and it cannot be overridden by the property defined in the file.
It is not the other way around, which causes some confusion and people thinking that despite having no readonly
set to true etc. still saying cannot be overridden.
So try to see if the property you set is actually using the value you wanted, if you are overriding from command line.
Upvotes: 10