Command line 如何在Ant';应用任务中的srcsfile标记?
给定以下ant任务:Command line 如何在Ant';应用任务中的srcsfile标记?,command-line,ant,mstest,Command Line,Ant,Mstest,给定以下ant任务: <apply executable="${mstest}" addsourcefile="false"> <arg value="/resultsfile:TestResults.trx" /> <arg value="/testsettings:ReleaseCodeCoverage.testsettings" /> <arg value="/detail:errormess
<apply executable="${mstest}" addsourcefile="false">
<arg value="/resultsfile:TestResults.trx" />
<arg value="/testsettings:ReleaseCodeCoverage.testsettings" />
<arg value="/detail:errormessage" />
<srcfile />
<fileset dir="bin/${buildType}">
<patternset>
<include name="*Tests.dll" />
</patternset>
</fileset>
</apply>
,但这在我的版本(1.7)中不受支持。这有点欺骗,但您可以根据自己的情况调整它。有一个嵌套元素targetfile
,可以与srcfile
相同的方式使用该元素-必要时放置在命令参数之间。targetfile的值是使用映射器元素从srcfile派生的。因此可以附加前缀。也许是这样的:
<apply executable="${mstest}" addsourcefile="false" relative="true">
<arg value="/resultsfile:TestResults.trx" />
<arg value="/testsettings:ReleaseCodeCoverage.testsettings" />
<arg value="/detail:errormessage" />
<targetfile/>
<fileset dir="bin/${buildType}">
<patternset>
<include name="*Tests.dll" />
</patternset>
</fileset>
<mapper type="regexp" from="(.*)" to="/TestContainer:bin/${buildType}/\1" />
</apply>
请注意使用了relative
属性,否则路径会在目标“filename”前面加前缀。我必须将\1更改为\0,因为它正在将/TestContainer转换为d:\TestContainer。非常感谢。我知道一定有办法!