1. In order to simple the compilation process, create an NAnt script and change the corresponding
library paths (in blue color) as follow:
<project name="Sample Script" default="build">
<if test="${ property::exists('debug') == false}">
<property name="debug" value="false"/>
</if>
<if test="${ property::exists('optimize') == false}">
<property name="optimize" value="true"/>
</if>
<if test="${ property::exists('exe_ext') == false}">
<property name="exe_ext" value=".exe"/>
<property name="exe_ext" value=".exe" if="${platform::is-win32() }"/>
</if>
<property name="basename" value="your application name"/>
<property name="refpath" value="${project::get-base-directory()}/../../../../dist/${nant.settings.currentframework}/bin/"/>
<property name="codepageid" value=""/>
<if test="${framework::get-family(framework::get-target-framework()) == 'mono'}">
<property name="codepageid" value="utf8"/>
</if>
<property name="distpath" value="your application directory"/>
<property name="warninglevel" value="2"/> <property name="mono_exec" value="mono.sh"/>
<if test="${ platform::is-win32()}">
<property name="mono_exec" value= "mono.bat"/> </if>
<property name="scriptpath" value="${project::get-base-directory()}/../../../../config/script"/>
<property name="compilerpath" value="${project::get-base-directory()}/../../../../dist/${nant.settings.currentframework}/bin"/>
<target name="debug" depends=""> <property name="debug" value="true"/>
</target> <target name="gac" depends="">
<property name="refpath" value=""/>
</target>
<target name="build-all" depends="genbuild">
</target>
<target name="gen">
<delete>
<fileset>
<include name= "./Generated/**"/>
<include name="./dir.txt"/>
</fileset>
</delete>
<property name="comppath" value="${scriptpath}/${mono_exec}"/>
<property name= "firstarg" value="${compilerpath}/idl2nc${exe_ext}"/>
<if test="${framework::get-family(framework::get-target-framework()) == 'net'}">
<property name= "comppath" value="${compilerpath}/idl2nc${exe_ext}"/>
<property name="firstarg" value=""/>
</if>
<exec program="${comppath}" workingdir="${compilerpath}" append="true" verbose="true" output="dir.txt">
<arg value="${firstarg}"/>
<arg value="-lang"/>
<arg value="CS"/>
<arg value="-I"/>
<arg value="${project::get-base-directory()}/Idl"/>
<arg value="-d"/>
<arg value="${project::get-base-directory()}/Generated"/>
<arg value="${project::get-base-directory()}/Idl/server.idl"/>
</exec>
</target>
<target name="clean">
<mkdir dir="${distpath}"/>
<delete>
<fileset>
<include name="${distpath}/${basename}-client${exe_ext}"/>
<include name="${distpath}/${basename}-client.pdb"/>
<include name="${distpath}/${basename}-server${exe_ext}"/>
<include name="${distpath}/${basename}-server.pdb"/>
</fileset>
</delete>
</target>
<target name="build" depends="clean">
<csc target="exe" codepage="${codepageid}" optimize="${optimize}" warninglevel="${warninglevel}"
output="${distpath}/${basename}-client${exe_ext}" debug="${debug}">
<sources>
<include name="Generated/demo/${basename}/**/*.cs"/>
<include name="Src/**/*.cs"/>
</sources>
<references>
<include asis="true" name="${refpath}TomORB_Primitive.dll"/>
<include asis="true" name="${refpath}TomORB_Based.dll"/>
<include asis="true" name="${refpath}TomORB.dll"/>
<include asis="true" name="${refpath}TomORB_CosNaming.dll"/>
</references>
<arg value="/main:demo.${basename}.Client"/>
</csc>
<csc target="exe" codepage="${codepageid}" optimize="${optimize}" warninglevel="${warninglevel}"
output="${distpath}/${basename}-server${exe_ext}" debug="${debug}">
<sources>
<include name="Generated/demo/${basename}/**/*.cs"/>
<include name="Src/**/*.cs"/>
</sources>
<references>
<include asis="true" name="${refpath}TomORB_Primitive.dll"/>
<include asis="true" name="${refpath}TomORB_Based.dll"/>
<include asis="true" name="${refpath}TomORB.dll"/>
<include asis="true" name="${refpath}TomORB_CosNaming.dll"/>
<include asis="true" name="${refpath}TomORB_POA.dll"/>
</references>
<arg value="/main:demo.${basename}.Server"/>
</csc>
</target>
</project>
2. run the following command in the application directory:
nant -t:net-1.1 debug build-all
3.
i. run server program in one console with the following command in application directory
hello-server.exe
ii. start another console to start up the name service
tomorb_home>\dist\net-1.1\bin\namesvc c:\NS_Ref
iii. start one more console to run client program in another console to test
against the server program
hello-client.exe
|