views:

93

answers:

3

Are the keywords used for project, target, task, function, ... in NAnt build files case sensitive or not?

+3  A: 

Try this NAnt build script:

<?xml version="1.0" encoding="utf-8" ?>
<!-- ====================================================================== -->
<!-- test case sensitiveness -->
<!-- ====================================================================== -->
<project name="test.casesensitiveness" default="test">
  <target name="test">
    <property name="foo" value="bar" />
    <echo message="Does property 'foo' exist? ${property::exists('foo')}" />
    <echo message="Does property 'Foo' exist? ${property::exists('Foo')}" />
  </target>
</project>

Here is the output:

test:

     [echo] Does property 'foo' exist? True
     [echo] Does property 'Foo' exist? False

So, yes identifiers in NAnt are case-sensitive.

The Chairman
I've used your test to try. And I found that not only identifiers but also keywords such as target, project are case-sensitive.Thanks a lot The Chairman.
Nam Gi VU
+1  A: 

Do you mean the keyword such as "target" vs "Target"? Why not just give it a try yourself?

In any case, all of the example and docs specifies lower case, so it's probably better to stick to the common standard.

Charles
Hi there, I'm a newbie using NAnt so that I post the quetion raised on my mind while I read about NAnt. I myself still not sure how to run a HelloWorld sample using NAnt -> That's why I ask.
Nam Gi VU
No problem. The best way to learn something is by trial and error.
Charles
+1  A: 

In a word: Yes.

NAnt is case-sensitive, even if Windows isn't fussed.

Brett Rigby