Your workaround does indeed work, and I was actually already doing that
for a different case, which I suppose brings up another issue.

<sometask if="${somevariable}">

Somevariable needs to be defined. :(  which means I have to explicitly
set it to false in all my projects that don't specifically want it.  A
bit annoying.

The workaround of course, is...

<property name="somevariable" value="false"
unless="${property-exists('somevariable')}/> 

Just more sugar to get the desired result I guess.  I've filed a bug on
sourceforge for the original bug.

Cheers,
Karl P
 

> -----Original Message-----
> From: Foster, Richard - PAL [mailto:[EMAIL PROTECTED] 
> Sent: Friday, June 09, 2006 12:53 PM
> To: Karl Palsson; nant-users@lists.sourceforge.net
> Subject: RE: [NAnt-users] Ifnot deprecated,having a few hard 
> times with replacements....
> 
> Karl,
> 
> Ah! Sorry, I misunderstood you. From your original message, 
> it appeared that you were saying that the error message told 
> you there was no CCNetProject property defined. This is in 
> the value attribute, not the test attribute, which left the 
> possibility that through some mechanism (either as a command 
> line parameter, or as a <property> element in your build 
> script), CCNetLabel was set to something independently of 
> CCNetProject. In that case, your test would pass, but the 
> setting of the value would not. 
> 
> I personally would probably have chosen this option (please 
> excuse any Outlook formatting weirdness):
> 
> <attribute type="AssemblyDescriptionAttribute"
> if="${property::exists('CCNetProject')}" value="CruiseControl 
> automated build of ${CCNetProject}" /> <attribute 
> type="AssemblyDescriptionAttribute"
> unless="${property::exists('CCNetProject')}" value="Release 
> Image of ${project::get-name()}" /> 
> 
> Unfortunately, it appears that this also fails to work. I 
> think you've found a bug!
> 
> As a workaround, perhaps the following would help:
> 
> <property name="ProjectNameForAssemblyInfo"
> value="${project::get-name()}" />
> <property if="${property::exists('CCNetProject')}"
> name="ProjectNameForAssemblyInfo" value="${CCNetProject}" />
> 
> <asminfo language="CSharp" output="AssemblyInfo.cs">
>     <imports>
>         <import namespace="System" />
>         <import namespace="System.Reflection" />
>          <import namespace="System.EnterpriseServices" />
>          <import namespace="System.Runtime.InteropServices" />
>     </imports>
>     <attributes>
>         <attribute type="AssemblyDescriptionAttribute"
> if="${property::exists('CCNetLabel')}" value="CruiseControl 
> automated build of ${ProjectNameForAssemblyInfo}" />
>         <attribute type="AssemblyDescriptionAttribute"
> unless="${property::exists('CCNetLabel')}" value="Release 
> Image of ${ProjectNameForAssemblyInfo}" />
>     </attributes>
> </asminfo>
> 
> Regards,
> Richard
> 
> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On Behalf 
> Of Karl Palsson
> Sent: Friday, June 09, 2006 06:06
> To: nant-users@lists.sourceforge.net
> Subject: Re: [NAnt-users] Ifnot deprecated,having a few hard 
> times with replacements....
> 
> > I would expect this to be the operation... After all you 
> are testing 
> > for the existence of 'CCNetLabel', not 'CCNetProject'. All this 
> > suggests to me is that you *do* have a CCNetLabel... Perhaps you 
> > should be using that to set your value instead?
> 
> I know I'm testing for the existence of netlabel, not netproject.
> Perhaps I've misunderstood the purpose of the if and unless 
> globally applicable attributes.
> 
> "If true then the task will be executed; otherwise, skipped. 
> The default is true."
> "Opposite of if. If false then the task will be executed; 
> otherwise, skipped. The default is false."
> 


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

Reply via email to