Given the following ant task:
<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>
How can I apply the prefix /TestContainer: to the contents of <srcfile />?
MSTest delimits switch names with a semicolon, not a space, so I can’t just append it as <arg value="/TestContainer">. I’ve also tried <srcfile prefix="/TestContainer:" /> as suggested here, but this is not supported in my version (1.7).
This is a bit of a cheat, but you might be able to adapt it to your case. The
applytask has a nested elementtargetfilethat can be used in the same way assrcfile– placed between the command arguments where needed. The value of targetfile is derived from srcfile using a mapper element. So you can attach prefixes. Something like this perhaps:Note the use of the
relativeattribute, otherwise the path gets prefixed in front of the target ‘filename’.