NAntContribのmsbuildタスク(^o^)
VS2005 SP1で入るASP.NET Web アプリケーションを使用しているなら、NAntでビルドする場合はNAntContribのmsbuildタスクを使用するといい。
OutputPathプロパティにNAntのビルド先のパスを指定しておけば、ビルド先の_PublishedWebsitesフォルダの中にバーチャルディレクトリにすれば動作確認可能な状態(binフォルダの中にコンパイル済みのアセンブリが配置され、コードビハインドのクラスは削除されてaspxだけを残してくれる)でWebアプリケーションが出力される。
以下にNAntのビルドファイルのサンプルを書いておく。
<!-- 各プロジェクトのビルド --> <target name="build" depends="init, create-common-assemblyinfo" description="Builds current configuration"> <echo message="Build Directory is ${build.dir}" /> <echo message="" /> <msbuild project="${project::get-name()}.sln"> <property name="Configuration" value="${if(build.debug == 'true', 'Debug', 'Release')}" /> <property name="Platform" value="Any CPU" /> <property name="OutputPath" value="${build.dir}/bin"/> </msbuild> <mkiisdir iisserver="localhost" dirpath="${build.dir}\bin\_PublishedWebsites\YourWebApplicationName" vdirname="YourVirtualDirectoryName" /> </target>