如何检查NAnt脚本是否设置了属性?

时间:2022-04-12 01:15:15

Hi I am create a release script using NAnt. How can I check a variable value is getting or not.

嗨,我使用NAnt创建一个发布脚本。如何检查变量值是否正常。

Now I call my script like this

现在我像这样调用我的脚本


    nant -buildfile:CreateNew.build -D:name="Test.V.1.0" -D:bIDs="2" -D:uIDs="'3'" 

Some times I will not pass uIDs.

有时我不会传递uID。

So I need to check in my nant script whether the uIDs is getting or not. How can I do that?

所以我需要在我的nant脚本中检查uID是否正常。我怎样才能做到这一点?

2 个解决方案

#1


10  

There's a property::exists function that you should use:

你应该使用一个property :: exists函数:

<if test="${property::exists('uIDs')}">
  <echo message="uIDs is set" />
</if>

#2


1  

Most (or even all?) NAnt tasks have if/unless attributes. You can use property::exists() function in conjunction with those attributes to condition your build script.

大多数(甚至全部?)NAnt任务都有if / unless属性。您可以将property :: exists()函数与这些属性结合使用来调整构建脚本。

#1


10  

There's a property::exists function that you should use:

你应该使用一个property :: exists函数:

<if test="${property::exists('uIDs')}">
  <echo message="uIDs is set" />
</if>

#2


1  

Most (or even all?) NAnt tasks have if/unless attributes. You can use property::exists() function in conjunction with those attributes to condition your build script.

大多数(甚至全部?)NAnt任务都有if / unless属性。您可以将property :: exists()函数与这些属性结合使用来调整构建脚本。