Continuous Integration & .NET: Part 1
by Thomas Beck


Listing One
<?xml version="1.0"?>
  <project name="Hello World" default="build" basedir=".">
     <property name="basename" value="HelloWorld"/>
     <property name="build.dir" value="cs_build"/>
     <target name="build">
      <mkdir dir="${build.dir}"/>
      <csc target="exe" output="${build.dir}\${basename}.exe">
        <sources>
          <includes name="src\HelloWorld.cs"/>
        </sources>
      </csc>
     </target>
  </project>

Listing Two
<?xml version="1.0"?>
  <project name="Business Object" default="deploy" basedir=".">
     <property name="basename" value="BusObjCS"/>
     <property name="build.dir" value="cs_build"/>
     <target name="build">
      <mkdir dir="${build.dir}"/>
      <copy file="c:\Program Files\ByteFX\ByteFX .Data Provider
            0.75\ByteFX.Data.dll" tofile="${build.dir}\ByteFX.Data.dll" />
      <csc target="library" output="${build.dir}\${basename}.dll"
            imports="System,System.Data,System.Data.SQLClient,
                     System.Collections.Specialized,System.XML">
        <sources>
          <includes name="src\BusObjCS.cs"/>
        </sources>
      <references>
                <includes asis="true" name="System.dll"/>
        <includes asis="true" name="System.Data.dll"/>
        <includes asis="true" name="System.XML.dll"/>
          <includes name="${build.dir}\ByteFX.Data.dll"/>
        </references>
      </csc>
     </target>
     <target name="deploy" depends="build">
      <copy file="${build.dir}\BusObjCS.dll"
          tofile="c:\Inetpub\test\bin\BusObjCS.dll" />
          <copy todir="c:\Inetpub\test">
          <fileset basedir="aspx">
          <includes name="*.aspx" />
          </fileset>
          </copy>
     </target>
  </project>

Listing Three
<target name="database">
     <exec program="${sql.program}" commandline="${sql.db} -u root
       &quot;source ${sql.drop_file}&quot;"/>
    <exec program="${sql.program}" commandline="${sql.db} -u root
      &quot;source ${sql.load_file}&quot;"/>
</target>

Listing Four
<target name="test" depends = "build, database">
    <copy file="${nunit.dll}" tofile="${build.dir}\nunit.framework.dll"/>
     <csc target="library" output="${build.dir}\${testname}.dll"
            imports="System,System.Data,System.XML,BusObjVB,nunit.framework">
         <sources>
           <includes name="src\BusObjTstCS.cs"/>
         </sources>
         <references>
             <includes asis="true" name="System.dll"/>
             <includes asis="true" name="System.Data.dll"/>
             <includes asis="true" name="System.XML.dll"/>
             <includes name="${build.dir}\BusObjCS.dll"/>
             <includes name="${build.dir}\nunit.framework.dll"/>
         </references>
      </csc>
       <nunit2>
           <formatter type="Plain" />
           <formatter type="Xml" usefile="true" outputdir="${build.dir}"
                extension=".xml" />
            <test assemblyname="${build.dir}\${testname}.dll"/>
        </nunit2>
     </target>

Listing Five
<target name="document" depends="test">
    <mkdir dir="${help.dir}"/>
     <vbdoc assembly="${build.dir}\${basename}.dll" destination="
           ${build.dir}\${basename}.xml" encoding="ansi" prefix="'''" >
         <sourcefiles>
             <includes name="${src.dir}\${basename}.vb" />
         </sourcefiles>
     </vbdoc>
     <ndoc>
        <assemblies basedir="${build.dir}">
            <includes name="${basename}.dll"/>
        </assemblies>
        <summaries basedir="${build.dir}">
            <includes name="${basename}_doc.xml"/>
         </summaries>
         <documenters>
         <documenter name="MSDN">
          <property name="OutputDirectory" value="${help.dir}"/>
          <property name="RootPageContainsNamespace" value="false"/>
           <property name="SortTOCByNamespace" value="true"/>
          </documenter>
        </documenters>
     </ndoc>
   </target>





