How do you pass a parameter to a method from nant? The nant method can take a project as parameter why not take any other type parameter? http://nant.sourceforge.net/release/0.85/help/tasks/script.html
如何将参数从nant传递给方法? nant方法可以将项目作为参数,为什么不采用任何其他类型参数? http://nant.sourceforge.net/release/0.85/help/tasks/script.html
The example give in the question takes zero arguments. Month name in NAnt
问题中的示例给出零参数。 NAnt中的月份名称
<property name="build.date" value="${datetime::parse('2014-07-29 10:21:02')}" />
<property name="build.month" value="${utils::GetMonth(${build.date})}}" />
[Function("GetMonth")]
public static string GetMonth(DateTime date)
{
return date.ToLongDateString().Split(new Char[]{' '})[1];
}
1 个解决方案
#1
0
You should avoid the second pair of curly braces, like this:
你应该避免使用第二对花括号,如下所示:
<property name="build.month" value="${utils::GetMonth(build.date)}" />
In case there's a problem passing DateTime
, you can try switching to string
parameter instead and parse it the proper way in the C# code.
如果传递DateTime时出现问题,您可以尝试切换到字符串参数,并在C#代码中以正确的方式解析它。
#1
0
You should avoid the second pair of curly braces, like this:
你应该避免使用第二对花括号,如下所示:
<property name="build.month" value="${utils::GetMonth(build.date)}" />
In case there's a problem passing DateTime
, you can try switching to string
parameter instead and parse it the proper way in the C# code.
如果传递DateTime时出现问题,您可以尝试切换到字符串参数,并在C#代码中以正确的方式解析它。