xml version="1.0" encoding="utf-8" ?>
<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="nunit.framework" publicKeyToken="96d09a1eb7f44a77" culture="Neutral" />
<bindingRedirect oldVersion="2.0.6.0" newVersion="2.4.3.0" />
<bindingRedirect oldVersion="2.1.4.0" newVersion="2.4.3.0" />
dependentAssembly>
assemblyBinding>
runtime>
configuration>
gacutil /i nunit.core.dll // 注册core
gacutil /i nunit.framework.dll //注册framework
gacutil /l //查看是否注册上
xml version="1.0"?>
<project name="CSharpMoney" default="ut">
<property name="output.dir" value="../bin" />
<property name="output.dll" value="../bin/cs-money.dll" />
<property name="reports.dir" value="../reports"/>
<target name="clean">
<delete dir="${output.dir}"/>
<delete dir="${reports.dir}"/>
target>
<target name="copyfile" depends="clean">
<mkdir dir="${output.dir}" unless="${directory::exists(output.dir)}" />
<copy file="../nunit/bin/nunit.framework.dll" todir="${output.dir}"
if="${file::exists('nunit/bin/nunit.framework.dll')}" />
target>
<target name="build" depends="copyfile">
<csc target="library" output="${output.dll}" debug="true">
<sources>
<include name="*.cs" />
sources>
<references>
<include name="../nunit/bin/nunit.framework.dll" />
references>
csc>
target>
<target name="ut" depends="build">
<mkdir dir="${reports.dir}"/>
<exec program="..NUnit unit-console.exe">
<arg value="${output.dll}"/>
<arg value="/config=cs-money.dll.config"/>
<arg value="/xml=${reports.dir}TestReport-Unit.xml"/>
<arg value="/nologo"/>
<arg value="/noshadow"/>
exec>
target>
project>来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/12639172/viewspace-364792/ ,如需转载,请注明出处,否则将追究法律责任。