ser*_*g10 12 .net ant nant build-automation build
是否有一个NAnt任务将回显出构建期间当前设置的所有属性名称和值?可能与Ant echoproperties任务相当的东西?
cra*_*igb 23
试试这个片段:
<project>
<property name="foo" value="bar"/>
<property name="fiz" value="buz"/>
<script language="C#" prefix="util" >
<code>
<![CDATA[
public static void ScriptMain(Project project)
{
foreach (DictionaryEntry entry in project.Properties)
{
Console.WriteLine("{0}={1}", entry.Key, entry.Value);
}
}
]]>
</code>
</script>
</project>
Run Code Online (Sandbox Code Playgroud)
你可以保存并运行nant.
不,没有任务或功能可以为你做这件事.
小智 6
我希望他们排序,所以我扩展了另一个答案.它不是很有效,但它有效:
<script language="C#" prefix="util" >
<references>
<include name="System.dll" />
</references>
<imports>
<import namespace="System.Collections.Generic" />
</imports>
<code>
<![CDATA[
public static void ScriptMain(Project project)
{
SortedDictionary<string, string> sorted = new SortedDictionary<string, string>();
foreach (DictionaryEntry entry in project.Properties){
sorted.Add((string)entry.Key, (string)entry.Value);
}
foreach (KeyValuePair<string, string> entry in sorted)
{
project.Log(Level.Info, "{0}={1}", entry.Key, entry.Value);
}
}
]]>
</code>
</script>
Run Code Online (Sandbox Code Playgroud)