我不記得爲什麼,但我放棄了使用< nunit2>任務,我一直在愉快地使用< exec> task和nunit-console.exe。如果有幫助,這是我的測試目標,運行NUnit和FxCop。請注意,如果可執行文件不在Windows路徑中,則會跳過它們。
<target name="test" description="Run unit tests" depends="build">
<property name="windows-path" value="${string::to-lower(environment::get-variable('PATH'))}"/>
<property name="nunit-in-path"
value="${string::contains(windows-path, 'nunit')}"/>
<echo message="Tests skipped because no NUnit folder was found in the Windows path."
unless="${nunit-in-path}"/>
<exec program="nunit-console.exe" if="${nunit-in-path}">
<arg file="../MyProject/MyProjectTest.nunit"/>
</exec>
<property name="fxcop-in-path"
value="${string::contains(windows-path, 'fxcop')}"/>
<echo message="FxCop skipped because no FxCop folder was found in the Windows path."
unless="${fxcop-in-path}"/>
<fxcop projectFile="../MyProject/MyProject.fxcop" directOutputToConsole="true"
failOnAnalysisError="true" if="${fxcop-in-path}"/>
</target>
我第二本。我就嘗試做在app.config魔術嘗試並獲得nunit2任務工作,但放棄了一段時間後,現在使用exec任務,如上所述。 – 2008-10-01 20:10:40