Hudsonの使い方⑪ Hudsonで.NETをビルド
今まではJavaプロジェクトをビルドしましたが、
.NETプロジェクトもHudsonでビルドしてみよう(゚д゚)/
まずは環境構築
.NET実行環境とユニットテスト環境をインストールします。
・.Net Framework3.5
・NAnt0.90 + NAntContrib0.85(Antの.Net版)
・NUnit2.5
Hudsonプラグインをインストールします。
・Hudson NAnt Plugin
・Hudson xUnit Plugin
default.build(Javaだとbuild.xml)を用意します。
Architect360さんの記事を参考にしました。
Visual Studioで作成したソリューションをコンパイルし、ユニットテストを実行します。
<?xml version="1.0" encoding="utf-8"?> <project name="UnitTestProject" default="build" basedir="."> <!-- ========================================================== --> <!-- 定義値 --> <!-- ========================================================== --> <property name="nant.settings.currentframework" value="net-3.5" /> <property name="bin.dir" value="bin"/> <property name="report.dir" value="report"/> <!-- ========================================================== --> <!-- Antタスク実行順序 --> <!-- ========================================================== --> <target name="build"> <call target="clean" /> <call target="compile" /> </target> <target name="build-unitTest"> <call target="clean" /> <call target="compile" /> <call target="unitTest" /> </target> <!-- ========================================================== --> <!-- ディレクトリをクリア --> <!-- ========================================================== --> <target name="clean"> <delete dir="${bin.dir}" /> <delete dir="${report.dir}" /> <mkdir dir="${bin.dir}" /> <mkdir dir="${report.dir}" /> </target> <!-- ========================================================== --> <!-- コンパイル --> <!-- ========================================================== --> <target name="compile"> <msbuild verbosity="Minimal"> <property name="Configuration" value="Release" /> <property name="OutputPath" value="..\${bin.dir}"/> </msbuild> </target> <!-- ========================================================== --> <!-- ユニットテスト実行 --> <!-- ========================================================== --> <target name="unitTest"> <nunit2 failonerror="false" verbose="true"> <formatter usefile="true" type="Xml" extension=".xml" outputdir="${report.dir}"/> <test> <assemblies basedir="${bin.dir}"> <include name="*Test.dll"/> </assemblies> </test> </nunit2> </target> </project>