I would prefer building my solution using the solution task as opposed to the VBC task but I have been unsuccessful in doing so.  I know I am missing something because when I compile using VBC and specify all includes and imports the exe works fine.  Using the SOLUTION task, the exe compiles without error but throws an exception when executed.  Any thoughts as to what I am doing wrong?

 

Thanks,

Shawn

 

-------------------------------------------------

--------------- VBC METHOD ----------------------

-------------------------------------------------

 

<?xml version="1.0"?>

<project name="CS" default="build" basedir="CS">

 

      <property name="nant.settings.currentframework" value="net-1.1"/>

    <property name="basename" value="CS"/>

    <property name="debug" value="true"/>

    <property name="build.dir" value="..\build\vbc"/>

 

    <target name="clean" description="cleans build directory">

        <delete>

            <fileset basedir="${build.dir}">

                        <includes name="*.*"/>

                        <excludes name="csconfig.xml"/>

                  </fileset>

        </delete>

    </target>

 

    <target name="build" depends="clean">

        <mkdir dir="${build.dir}"/>

        <vbc target="winexe" output="${build.dir}\${basename}.exe" debug="${debug}"

imports="Microsoft.VisualBasic,System,System.Collections,System.Data,System.Diagnostics,System.Drawing,System.Windows.Forms"

                optioncompare="text"

                optionexplicit="true"

                optionstrict="false"

                rootnamespace="CS"

                removeintchecks="true">

            <sources>

                <includes name="*.vb"/>

            </sources>

            <references>

                <includes asis="true" name="System.dll"/>

                <includes asis="true" name="System.Data.dll"/>

                <includes asis="true" name="System.Drawing.dll"/>

                <includes asis="true" name="System.Windows.Forms.dll"/>

                <includes asis="true" name="System.XML.dll"/>

            </references>

            <arg value="/main:CS.Form1"/>

        </vbc>

        <copy file="csconfig.xml" todir="${build.dir}"/>

    </target>

 

    <target name="run" depends="build">

        <exec program="${basename}.exe" basedir="${build.dir}"/>

    </target>

</project>

 

-------------------------------------------------

------------- SOLUTION METHOD -------------------

-------------------------------------------------

 

<?xml version="1.0"?>

<project name="BuildingSolution" default="build" basedir="." xmlns="http://nant.sf.net/schemas/nant-0.85.win32.net-1.0.xsd">

    <property name="nant.settings.currentframework" value="net-1.1"/>

    <property name="Solution.Filename" value="CS.sln"/>

    <property name="Solution.Configuration" value="debug"/>

    <property name="build.dir" value="build\solution"/>

    <target name="clean" description="remove all generated files">

        <delete>

                  <fileset basedir="${build.dir}">

                        <includes name="*.*"/>

                        <excludes name="csconfig.xml"/>

                  </fileset>

        </delete>

    </target>

    <target name="build" description="compiles the source code" depends="clean">

            <solution solutionfile="${Solution.Filename}" outputdir="${build.dir}" configuration="${Solution.Configuration}" verbose="true"/>

            <copy file="csconfig.xml" todir="${build.dir}"/>

    </target>

</project>

Reply via email to