Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/ant/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Command line 如何在Ant';应用任务中的srcsfile标记?_Command Line_Ant_Mstest - Fatal编程技术网

Command line 如何在Ant';应用任务中的srcsfile标记?

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

给定以下ant任务:

    <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。非常感谢。我知道一定有办法!