I'm working with ant for the first time, read lots of tutorials and examples, and still cant make this works. Every target works, but with test im getting
"Test TestMaze failed (crashed)."
I've tried to change lot of things (using lot of examples), still nothing. Can anyone tell me where is the problem please? Thanks a lot.
<?xml version="1.0"?>
<project name="Maze" default="default" basedir=".">
<property name="src.dir" location="src" />
<property name="build.dir" location="build" />
<property name="dist.dir" location="dest-server" />
<property name="test.dir" location="test" />
<property name="test.report.dir" location="testreport" />
<target name="clean">
<delete dir="${build.dir}" />
<delete dir="${dist.dir}" />
<delete dir="${test.report.dir}" />
</target>
<path id="junit.class.path">
<pathelement location="lib/junit-4.10.jar" />
<pathelement location="${build.dir}" />
</path>
<target name="compile" depends="clean">
<mkdir dir="${build.dir}" />
<mkdir dir="${dist.dir}" />
<javac srcdir="${src.dir}" destdir="${build.dir}" />
<javac srcdir="${test.dir}" destdir="${build.dir}">
<classpath refid="junit.class.path" />
</javac>
<jar destfile="${dist.dir}\Maze.jar" basedir="${build.dir}">
<manifest>
<attribute name="Main-Class" value="maze.tape.Commands" />
</manifest>
</jar>
</target>
<target name="test" depends="compile">
<junit printsummary="on" fork="true" haltonfailure="yes">
<classpath refid="junit.class.path" />
<formatter type="xml" />
<batchtest todir="${test.report.dir}">
<fileset dir="${test.dir}">
<include name="**/*Test*.java" />
</fileset>
</batchtest>
</junit>
</target>
<target name="run" depends="compile">
<java jar="dest-server/Maze.jar" fork="true"/>
</target>
</project>
Your test target is generating an xml file because you are using:
<formatter type="xml" />
when the attribute usefile is not used, the default value will be set and in this case, the value is "true".
You can set the attribute to false and the output will be displayed in the console.
Related
Please help, errors occur when I run build with ant, and I'm new to apache ant.
My project composes of two modules, this build.xml is my main project build file, and dependency module is set within the path label.
My build.xml:
<?xml version="1.0" encoding="utf-8"?>
<project name="GameServer" basedir=".">
<property name="build.dir" value="bin" />
<property name="lib.dir" value="lib" />
<property name="dist.dir" value="dist" />
<property name="source.dir" value="src" />
<property name="web.dir" value="WebContent" />
<property name="TODAY" value="2019-09-10"/>
<path id="classpath">
<fileset dir="${lib.dir}">
<include name="**/*.jar" />
</fileset>
<path location="D:\backend\worldAndBattle\trunk\worldAndBattle" />
</path>
<!-- 初始化 -->
<target name="init" description="Prepare for build">
<mkdir dir="${dist.dir}" />
<mkdir dir="${build.dir}" />
</target>
<!-- 清理 -->
<target name="clean" description="Clean all build products">
<delete dir="${dist.dir}" quiet="true"/>
<delete dir="${build.dir}" quiet="true"/>
</target>
<!-- 编译代码 -->
<target name="compile" description="Compile application" depends="clean, init">
<javac srcdir="${source.dir}"
destdir="${build.dir}"
includes="**/*.java"
debug="on"
deprecation="on"
source="1.7"
includeAntRuntime="false">
<classpath refid="classpath" />
</javac>
</target>
<!-- 打包sql -->
<target name="sql">
<jar destfile="${build.dir}/sql.jar">
<fileset dir="${source.dir}"
includes="**/sql.xml,
**/*.properties"
/>
<manifest>
<attribute name="Author" value="${user.name}" />
<attribute name="Implementation-Date" value="${TODAY}" />
</manifest>
</jar>
</target>
<!-- 打包game -->
<target name="game" depends="compile, sql" >
<jar destfile="${dist.dir}/game.jar">
<fileset dir="${build.dir}"
includes="**/*"
excludes="com/bianfeng/game/hotswap/*,
**/*Test.class,
**/Foo.class,
**/applicationContext.xml, **/*.js, log4j.properties, logback.xml, conf.xml,
**/sql.xml"
/>
<fileset dir="${source.dir}"
includes="**/*.properties"
/>
<manifest>
<attribute name="Author" value="${user.name}" />
<attribute name="Implementation-Date" value="${TODAY}" />
<attribute name="Main-Class" value="com.bianfeng.game.Main" />
</manifest>
</jar>
</target>
<!-- 打包game -->
<target name="game-with-application" depends="compile, sql" >
<jar destfile="${dist.dir}/game.jar">
<fileset dir="${build.dir}"
includes="**/*"
excludes="com/bianfeng/game/hotswap/*,
**/*Test.class,
**/Foo.class,
**/*.js, log4j.properties, logback.xml, conf.xml,
**/sql.xml"
/>
<manifest>
<attribute name="Author" value="${user.name}" />
<attribute name="Implementation-Date" value="${TODAY}" />
</manifest>
</jar>
</target>
<target name="game-cross" depends="compile, sql" >
<jar destfile="${dist.dir}/game-cross.jar">
<fileset dir="${build.dir}"
includes="**/*"
excludes="**/*Test.class,
**/Foo.class,
**/*.js, log4j.properties, logback.xml, conf.xml,
**/sql.xml,
**/*Action.class,
**/*Dao.class
"
/>
<manifest>
<attribute name="Author" value="${user.name}" />
<attribute name="Implementation-Date" value="${TODAY}" />
</manifest>
</jar>
</target>
</project>
and, I am attaching an image with my errors.
When I run compile, I get errors. And I don't know what should I do?
My Build.xml as beolw
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE project []>
<project name="Learning TestNG" default="usage" basedir=".">
<!-- ========== Initialize Properties ============================== -->
<property environment="env"/>
<property name="ws.home" value="${basedir}"/>
<property name="ws.jars" value="E:\SELENIUM_DOWNLOADS\Selenium Jars"/>
<property name="test.dest" value="${ws.home}/build"/>
<property name="test.src" value="${ws.home}/src"/>
<property name="testng-report-dir" value="${test.src}/TestNGreport" />
<!--target name="start-selenium-server">
<java jar="${ws.home}/lib/selenium-server.jar"/>
</target-->
<target name="setClassPath" unless="test.classpath">
<path id="classpath_jars">
<fileset dir="${ws.jars}" includes="*.jar"/>
</path>
<pathconvert pathsep=":"
property="test.classpath"
refid="classpath_jars"/>
</target>
<path id="testcase.path">
<pathelement location="${test.dest}"/>
<fileset dir="${ws.jars}">
<include name="*.jar"/>
</fileset>
</path>
<target name="init" depends="setClassPath">
<tstamp>
<format property="start.time" pattern="MM/dd/yyyy hh:mm aa" />
</tstamp>
<condition property="ANT"
value="${env.ANT_HOME}/bin/ant.bat"
else="${env.ANT_HOME}/bin/ant">
<os family="windows" />
</condition>
<taskdef name="testng" classpath="${test.classpath}"
classname="org.testng.TestNGAntTask" />
</target>
<!-- all -->
<target name="all">
</target>
<!-- clean -->
<target name="clean">
<delete dir="${test.dest}"/>
</target>
<!-- compile -->
<target name="compile" depends="init, clean" >
<delete includeemptydirs="true" quiet="true">
<fileset dir="${test.dest}" includes="**/*"/>
</delete>
<echo message="making directory..."/>
<mkdir dir="${test.dest}"/>
<echo message="classpath------: ${test.classpath}"/>
<echo message="compiling..."/>
<javac
debug="true"
destdir="${test.dest}"
srcdir="${test.src}"
classpath="${test.classpath}"
includeantruntime="false" >
</javac>
</target>
<!-- build -->
<target name="build" depends="init">
</target>
<!-- run -->
<target name="run" depends="compile">
<testng classpath="${test.classpath}: ${test.dest}"
suitename="SuiteName">
<xmlfileset dir="src/test/resources/" includes="TestNG.xml"/>
</testng>
</target>
<target name="usage">
<echo>
ant run will execute the test
</echo>
</target>
<path id="test.c">
<fileset dir="${ws.jars}" includes="*.jar"/>
</path>
<target name="makexsltreports">
<mkdir dir="${ws.home}/XSLT_Reports/output"/>
<xslt in="${ng.result}/testng-results.xml" style="src/test
/resources/testng-results.xsl" out="${ws.home}/XSLT_Reports/output
/index.html" classpathref="test.c" processor="SaxonLiaison">
<param name="testNgXslt.outputDir" expression="${ws.home}/XSLT_Reports
/output/"/>
<param name="testNgXslt.showRuntimeTotals" expression="true"/>
</xslt>
</target>
</project>
TestNG.xml is as below
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd" >
<suite name="SuiteName">
<test name="Login Test" allow-return-values="true">
<classes>
<class name="com.qtpselenium.zoho.project.testcases.LoginTest" />
</classes>
</test>
<test name="Lead Test" allow-return-values="true">
<classes>
<class name="com.qtpselenium.zoho.project.testcases.LeadTest" />
</classes>
</test>
Error displayed below
run:
[testng] [TestNG] [ERROR]
[testng] Cannot instantiate class com.qtpselenium.zoho.project.testcases.Lead
Test
BUILD SUCCESSFUL
Total time: 3 seconds
what will be solution for this not getting route cause..please it will better as early as possible
I am using this command to build dojo 1.9.3
"ant -file buildWAR.xml -DbuildWorkDir=G:\Codebase\folder\PSInviter -DzuoraJarFile=WebContent\WEB-INF\lib\zuora.jar"
but in reponse of this I am getting the following error:
[exec] G:\Codebase\folder\PSInviter\WebContent\js\dojo-release-1.9.3-src\util\ buildscripts>java -Xms256m -Xmx256m -cp " G:\Codebase\folder\PSInviter\WebContent\js\dojo-release-1.9.3-src\uti
l\buildscripts\../shrinksafe/js.jar";"G:\Codebase\folder\
PSInviter\WebContent\js\dojo-release-1.9.3-src\util\buildscripts\../closureCompi
ler/compiler.jar";"G:\Codebase\folder\PSInviter\WebConten
t\js\dojo-release-1.9.3-src\util\buildscripts\../shrinksafe/shrinksafe.jar" org.
mozilla.javascript.tools.shell.Main "G:\Codebase\folder\
PSInviter\WebContent\js\dojo-release-1.9.3-src\util\buildscripts\../../dojo/dojo
.js" baseUrl="G:\Codebase\folder\PSInviter\WebContent\js\
dojo-release-1.9.3-src\util\buildscripts\../../dojo" load=build releaseDir=G:\Codebase\folder\PSInviter\WebContent\js\builds/ profileFile
=G:\Codebase\folder\PSInviter/WebContent/js/somefolder
/timedriver.profile.js copyTests=false action=clean,release optimize=shrinksafe
localeList=ar,ca,cs,da,de,de-de,el,en,en-au,en-ca,en-gb,en-us,es,es-es,fi,fr,he,
hu,it,it-it,ja,ja-jp,ko,ko-kr,nb,nl,pl,pt,pt-br,ru,sk,sl,sv,th,tr,zh,zh-cn,zh-tw
releaseName=1405191028 internStrings=true cssOptimize=comments excludeFromBase=
true
[exec] org.mozilla.javascript.WrappedException: Wrapped java.net.MalformedURLException: unknown protocol: g
below is my buildWar.xml file's code
<?xml version="1.0"?>
<!-- Build the PSInviter WAR project -->
<project name="PSInviter.WAR" basedir="." default="default">
<!-- All properties are in build.properties -->
<property environment="env" />
<property file="buildWAR.properties" />
<property name="dojoSrcRelease" location="WebContent/js/dojo-release-1.9.3-src" />
<property name="outputDir" location="WebContent/js/builds" />
<path id="compile.classpath">
<pathelement path="${classes.dir}" />
<fileset dir="${was.api.dir}" includes="runtimes/websphere_apis.jar" />
<fileset dir="${was.api.dir}" includes="java/jre/lib/**/*.jar" />
<fileset dir="${lib.dir}" includes="**/*.jar" />
</path>
<target name="init" description="Initialize the build process">
<delete dir="${build.dir}/js/builds"/>
<mkdir dir="${build.dir}/js/builds"/>
<delete dir="${outputDir}"/>
<mkdir dir="${outputDir}"/>
<mkdir dir="${temp.artifacts.dir}"/>
<tstamp>
<format property="buildDateTime" pattern="yyMMddHHmm"/>
</tstamp>
</target>
<target name="build-dojo" description="" depends="init">
<exec dir="${dojoSrcRelease}/util/buildscripts/" executable="${dojoSrcRelease}/util/buildscripts/build.bat">
<arg line="releaseDir="${outputDir}/""/>
<arg line="profileFile="${basedir}/WebContent/js/someFolder/timedriver.profile.js""/>
<arg line="copyTests=false"/>
<arg line="action=clean,release"/>
<arg line="optimize=shrinksafe"/>
<arg line="localeList=ar,ca,cs,da,de,de-de,el,en,en-au,en-ca,en-gb,en-us,es,es-es,fi,fr,he,hu,it,it-it,ja,ja-jp,ko,ko-kr,nb,nl,pl,pt,pt-br,ru,sk,sl,sv,th,tr,zh,zh-cn,zh-tw"/>
<arg line="releaseName=${buildDateTime}" />
<arg line="internStrings=true" />
<arg line="cssOptimize=comments" />
<arg line="excludeFromBase=true" />
</exec>
<replaceregexp file="${basedir}/WebContent/WEB-INF/startup.properties"
match="TDBuildNumber=(.*)"
replace="TDBuildNumber=${buildDateTime}"
byline="true"/>
<java dir="WebContent/js" classname="org.mozilla.javascript.tools.shell.Main" fork="true">
<arg value="nonDojo/nonDojoBuilder.js"/>
<arg value="nonDojo/base.js|nonDojo/login.js|nonDojo/securityPolicy.js|nonDojo/MD5.js|jsonrpc.js|nonDojo/loginpage.js"/>
<arg value="${outputDir}/${buildDateTime}/loginPage.js"/>
<classpath>
<pathelement location="${exec.dir}/../WebContent/WEB-INF/lib/js.jar"/>
<pathelement location="${exec.dir}/../WebContent/WEB-INF/lib/shrinksafe.jar"/>
</classpath>
</java>
<java dir="WebContent/js" classname="org.mozilla.javascript.tools.shell.Main" fork="true">
<arg value="nonDojo/nonDojoBuilder.js"/>
<arg value="nonDojo/base.js|nonDojo/login.js|nonDojo/sfdclanding.js|nonDojo/securityPolicy.js|nonDojo/MD5.js|jsonrpc.js|nonDojo/registration.js"/>
<arg value="${outputDir}/${buildDateTime}/sfdclandingPage.js"/>
<classpath>
<pathelement location="${exec.dir}/../WebContent/WEB-INF/lib/js.jar"/>
<pathelement location="${exec.dir}/../WebContent/WEB-INF/lib/shrinksafe.jar"/>
</classpath>
</java>
<copy file="${basedir}/WebContent/js/jsonrpc.js" todir="${outputDir}/${buildDateTime}" />
<copy file="${basedir}/WebContent/js/nonDojo/securityPolicy.js" todir="${outputDir}/${buildDateTime}" />
</target>
<target name="copy-files" depends="build-dojo" description="Copy the web content files">
<copy todir="${build.dir}">
<fileset dir="${web.dir}">
<exclude name="**/.svn"/>
<exclude name="**/js/dojo*/**"/>
<exclude name="**/js/someFolder/**"/>
</fileset>
</copy>
<copy todir="${build.dir}/AST" failonerror="true">
<fileset dir="AST">
<exclude name="**/.svn"/>
</fileset>
</copy>
<copy todir="${build.dir}/WEB-INF/lib" failonerror="true" file="${zuoraJarFile}" overwrite="true" />
</target>
<target name="compile" depends="copy-files" description="Compile the Java source code">
<mkdir dir="${classes.dir}"/>
<javac srcdir="${src.dir}"
destdir="${classes.dir}"
includes="**/*.java"
classpathref="compile.classpath"
source="${javac.source}"
target="${javac.target}"
debug="${javac.debug}"
fork="true"
includeAntRuntime="no"
/>
</target>
<target name="war" depends="compile" description="Create the WAR file">
<manifest file="MANIFEST.MF">
<attribute name="Build-Version" value="${buildVersion} - ${buildDateTime}"/>
</manifest>
<delete dir="${build.dir}/AST"/>
<mkdir dir="target"/>
<war destfile="target/${war.file}"
webxml="${web-inf.dir}/web.xml"
basedir="${build.dir}"
manifest="MANIFEST.MF"
/>
<copy todir="${temp.artifacts.dir}" failonerror="true">
<fileset dir="target">
<exclude name="**/.svn"/>
<include name="${war.file}"/>
</fileset>
</copy>
</target>
<target name="jar" depends="compile" description="Create the timedriver jar file">
<jar destfile="target/${jar.file}"
basedir="${classes.dir}"
/>
<copy todir="${temp.artifacts.dir}" overwrite="true" failonerror="true">
<fileset dir="target">
<exclude name="**/.svn"/>
<include name="${jar.file}"/>
</fileset>
</copy>
</target>
<target name="default" depends="war, jar" />
</project>
Anyone know about this error, please help.
Regards
I was experiencing a similar problem and after some investigation I realize that the problem was that I have ignored a couple of directories required to create the dojo build.
In my particular case the issue was related to ignoring (deleted) the util/build directory of the sdk.
You can debug this by adding:
console.log(url);
At dojo/_base/configRhino.js on the isLocal function.
This function determines if a file is local or a URL and if the file does not exists then it assumes that is a URL and then the exception occur.
That extra line is going to print all the files that is trying to use and when it breaks the last file path that printed is the faulty one.
All of this of course is just a guess based on my experience.
We are having a problem when running unit tests using CPsuite and JMockit.
The tests run fine when executed in Eclipse, but if we use our Ant script to run all the tests (see script at the end of this question), we get the following exception:
Testcase: initializationError took 0 sec
Caused an ERROR
(class: mockit/internal/startup/JDK6AgentLoader, method: getVirtualMachineImplementationFromEmbeddedOnes signature: ()Lcom/sun/tools/attach/VirtualMachine;) Wrong return type in function
java.lang.VerifyError: (class: mockit/internal/startup/JDK6AgentLoader, method: getVirtualMachineImplementationFromEmbeddedOnes signature: ()Lcom/sun/tools/attach/VirtualMachine;) Wrong return type in function
at mockit.internal.startup.AgentInitialization.initializeAccordingToJDKVersion(AgentInitialization.java:21)
at mockit.internal.startup.Startup.verifyInitialization(Startup.java:86)
at mockit.Invocations.<clinit>(Invocations.java:22)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:169)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
This only happens on Ant, and only if there is a class that uses JMockit in the CPSuite set.
Anyone know why are we getting this error?
The Ant Script:
<project name="chughtai.junit" default="run" basedir=".">
<taskdef resource="net/sf/antcontrib/antlib.xml"/>
<!-- https://junit-anttask.dev.java.net/ -->
<!--
<taskdef name="junit2" classname="com.sun.ant.junit.JUnitTask">
<classpath>
<pathelement path="lib/junit-anttask.jar" />
<pathelement path="lib/junit-4.4.jar" />
</classpath>
</taskdef>
-->
<property environment="env"/>
<property file="junit.build.properties"/>
<filelist id="third-party_jars" dir="lib">
<file name="${ext.classpath}/bin/lib/j2ee.jar"/>
</filelist>
<path id="project.path">
<pathelement path="${env.JAVA_HOME}/lib/tools.jar"/>
<pathelement location="classes/"/>
<fileset dir="lib">
<include name="**/*.jar"/>
<include name="**/*.properties"/>
</fileset>
<dirset dir="${build.dir}">
<include name="apps/**/classes"/>
<exclude name="apps/**/*Test*"/>
</dirset>
<pathelement location="${basedir}/junittestcases"/>
<filelist refid="third-party_jars"/>
<pathelement path="${ext.classpath}"/>
<pathelement location="${ext.classpath}/WEB-INF/classes"/>
</path>
<target name="init">
<mkdir dir="${prd.junit.test.report.dir}" />
<mkdir dir="${prd.junit.test.report.dir}/html" />
</target>
<!-- default target -->
<target name="run" depends="init">
<property name="myclasspath" refid="project.path"/>
<property name="java.class.path" refid="project.path"/>
<echo message="***Junit Controller Application***"/>
<echo message="basedir is ${basedir}"/>
<!--<echo message="${myclasspath}" />-->
<junit dir="${basedir}/junittestcases/" printsummary="yes" haltonfailure="no" fork="no" forkmode="once" reloading="false" maxmemory="1024m">
<jvmarg value="-Xms768M"/>
<jvmarg value="-Xmx1024M"/>
<jvmarg value="-XX:MaxPermSize=256M"/>
<sysproperty key="tests" value="${tests}"/>
<sysproperty key="java.class.path" value="${myclasspath}"/>
<formatter type="plain" usefile="true" extension=".txt" />
<formatter type="xml" />
<classpath refid="project.path"/>
<test name="${use.testcase}" haltonfailure="no" fork="false" todir="${prd.junit.test.report.dir}" if="use.testcase">
<formatter type="xml" />
</test>
</junit>
<!-- Generate the Unit Test reports -->
<junitreport todir="${prd.junit.test.report.dir}">
<fileset dir="${prd.junit.test.report.dir}">
<include name="*.xml" />
</fileset>
<report todir="${prd.junit.test.report.dir}/html" styledir="${xsl.templates}" format="frames">
<param name="build.number" expression="${app.build}" />
<param name="application.name" expression="${app.name}" />
</report>
</junitreport>
</target>
<target name="emma.report" depends ="" description="Creates 3 EMMA report formats based on the coverage data gathered.">
<if>
<available file="coverage.ec" />
<then>
<move file="coverage.ec" tofile="${coverage.dir}/junits.ec" overwrite="true"/>
</then>
</if>
<emma>
<report sourcepath="src" sort="+block,+name,+method,+class" metrics="method:70,block:80,line:80,class:100">
<!-- collect all EMMA data dumps (metadata and runtime)
[this can be done via nested <fileset> fileset elements
or <file> elements pointing to a single file]:
-->
<fileset dir="${coverage.dir}">
<include name="*.em" />
<include name="*.ec" />
</fileset>
<!-- for every type of report desired, configure a nested
element; various report parameters
can be inherited from the parent <report>
and individually overridden for each report type:
-->
<txt outfile="${coverage.dir}/coverage.txt" depth="package" columns="class,method,block,line,name" />
<xml outfile="${coverage.dir}/coverage.xml" depth="package" />
<html outfile="${coverage.dir}/coverage.html" depth="method" columns="name,class,method,block,line" />
</report>
</emma>
</target>
<target name="clean">
<delete file="${coverage.dir}/coverage.*" />
</target>
</project>
I have almost cracked this NAnt thing, and all I can say is Visual Studio has certainly "hidden" a lot of things behind the covers when it comes to compiling.
I have my VB.NET app compiling successfully now via NAnt, however it does not run, it comes up with the error:
Could not find any resources appropriate for the specified culture or the neutral culture.
Make sure "APP3.Resource.resources" was correctly embedded or linked into assembly "APP3" at compile time, or that all the satellite assemblies required are loadable and fully signed.
When I compile and run in Visual Studio it all works fine.
The build file includes all the .resx files for all projects being compiled, and I do not get any errors during the NAnt build process.
Any ideas would be appreciated :-)
Oh, and I notice that my EXE is 6kb smaller, so something is obviously missing, and the NAnt process does not seem to create a manifest file either, or all the XML files, I assume that is normal?
<?xml version="1.0"?>
<project name="APP3" default="build" basedir="..\">
<description>APP3 build</description>
<property name="nant.settings.currentframework" value="net-3.5" />
<property name="projectversion" value="3.8.0" />
<property name="project.config" value="debug" />
<target name="init">
<call target="${project.config}" />
</target>
<target name="debug">
<property name="project.config" value="debug" />
<property name="build.debug" value="true" />
<property name="basedir.suffix" value="-debug" />
</target>
<target name="release">
<property name="project.config" value="release" />
<property name="build.debug" value="false" />
<property name="basedir.suffix" value="-release" />
</target>
<target name="clean">
<delete file="${project::get-base-directory()}${project::get-name()}_${projectversion}${basedir.suffix}\APP3_DataClasses.dll" failonerror="false" />
<delete file="${project::get-base-directory()}${project::get-name()}_${projectversion}${basedir.suffix}\classUtilities.dll" failonerror="false" />
<delete file="${project::get-base-directory()}${project::get-name()}_${projectversion}${basedir.suffix}\APP3.exe" failonerror="false" />
</target>
<target name="build-classutilities" depends="init, clean" description="compiles the APP3 utilities class">
<property name="build.dir" value="${project::get-base-directory()}/${project::get-name()}_${projectversion}${basedir.suffix}"/>
<mkdir dir="${build.dir}" />
<vbc target="library" output="${build.dir}/classUtilities.dll" debug="${build.debug}" rootnamespace="classUtilities">
<imports>
<import namespace="Microsoft.VisualBasic" />
<import namespace="System" />
<import namespace="System.Collections" />
<import namespace="System.Collections.Generic" />
<import namespace="System.Data" />
<import namespace="System.Diagnostics" />
<import namespace="System.Linq" />
<import namespace="System.Xml.Linq" />
</imports>
<sources>
<include name="${project::get-base-directory()}/classUtilities/Utilities.vb" />
</sources>
<resources>
<include name="${project::get-base-directory()}/classUtilities/*.resx" />
<include name="${project::get-base-directory()}/classUtilities/My Project/*.resx" />
</resources>
<references>
<include name="System.dll" />
<include name="System.Data.dll" />
<include name="System.Core.dll" />
<include name="System.Xml.dll" />
<include name="System.Xml.Linq.dll" />
</references>
</vbc>
</target>
<target name="build-dataclasses" depends="build-classutilities" description="compiles the APP3 data classes">
<property name="build.dir" value="${project::get-base-directory()}/${project::get-name()}_${projectversion}${basedir.suffix}"/>
<mkdir dir="${build.dir}" />
<vbc target="library" output="${build.dir}/APP3_DataClasses.dll" debug="${build.debug}" rootnamespace="APP3_DataClasses">
<imports>
<import namespace="Microsoft.VisualBasic" />
<import namespace="System" />
<import namespace="System.Collections" />
<import namespace="System.Collections.Generic" />
<import namespace="System.Configuration" />
<import namespace="System.Data" />
<import namespace="System.Diagnostics" />
<import namespace="System.Xml" />
<import namespace="System.Xml.Linq" />
<import namespace="Iesi.Collections" />
</imports>
<sources>
<include name="${project::get-base-directory()}/APP3_DataClasses/**/*.vb" />
</sources>
<resources prefix="APP3_DataClasses">
<include name="${project::get-base-directory()}/APP3_DataClasses/*.resx" />
<include name="${project::get-base-directory()}/APP3_DataClasses/My Project/*.resx" />
<include name="${project::get-base-directory()}/APP3_DataClasses/*.hbm.xml" />
</resources>
<references>
<include name="System.dll" />
<include name="System.Core.dll" />
<include name="System.Xml.dll" />
<include name="System.Xml.Linq.dll" />
<include name="C:\Dev\NHibernate-2.1.2\Required_Bins\Iesi.Collections.dll" />
</references>
</vbc>
</target>
<target name="build" description="compiles the source code" depends="build-dataclasses">
<property name="build.dir" value="${project::get-base-directory()}/${project::get-name()}_${projectversion}${basedir.suffix}"/>
<mkdir dir="${build.dir}" />
<copy file="C:\Dev\NHibernate-2.1.2\Required_Bins\NHibernate.dll" tofile="${build.dir}/NHibernate.dll" />
<copy file="C:\Dev\NHibernate-2.1.2\Required_Bins\Iesi.Collections.dll" tofile="${build.dir}/Iesi.Collections.dll" />
<copy file="C:\Dev\NHibernate-2.1.2\Required_Bins\log4net.dll" tofile="${build.dir}/log4net.dll" />
<copy file="${project::get-base-directory()}/APP3/hibernate.cfg.xml" tofile="${build.dir}/hibernate.cfg.xml" />
<copy file="C:\Dev\LumenWorks.Framework\LumenWorks.Framework.3.8.0\LumenWorks.Framework.IO.dll" tofile="${build.dir}/LumenWorks.Framework.IO.dll" />
<copy file="C:\Program Files (x86)\Microsoft Visual Studio 9.0\Visual Studio Tools for Office\PIA\Office11\Microsoft.Office.Interop.Word.dll" tofile="${build.dir}/Microsoft.Office.Interop.Word.dll" />
<copy file="C:\Program Files (x86)\Microsoft Visual Studio 9.0\Visual Studio Tools for Office\PIA\Office11\office.dll" tofile="${build.dir}/office.dll" />
<copy file="C:\Program Files (x86)\Microsoft Visual Studio 9.0\Visual Studio Tools for Office\PIA\Office11\Microsoft.Vbe.Interop.dll" tofile="${build.dir}/Microsoft.Vbe.Interop.dll" />
<copy file="${project::get-base-directory()}/APP3/app.config" tofile="${build.dir}/APP3.exe.config" />
<copy todir="${build.dir}">
<fileset basedir="C:\Dev\NHibernate-2.1.2\Required_For_LazyLoading\Castle\">
<include name="*.dll" />
</fileset>
</copy>
<vbc target="winexe" output="${build.dir}/APP3.exe" debug="${build.debug}" rootnamespace="APP3">
<imports>
<import namespace="Microsoft.VisualBasic" />
<import namespace="System" />
<import namespace="System.Collections" />
<import namespace="System.Collections.Generic" />
<import namespace="System.Configuration" />
<import namespace="System.Data" />
<import namespace="System.Data.SqlClient" />
<import namespace="System.Diagnostics" />
<import namespace="System.Drawing" />
<import namespace="System.Windows.Forms" />
<import namespace="System.IO" />
<import namespace="System.Xml" />
</imports>
<sources>
<include name="${project::get-base-directory()}/${project::get-name()}/*.vb" />
<include name="${project::get-base-directory()}/${project::get-name()}/classes/*.vb" />
<include name="${project::get-base-directory()}/${project::get-name()}/historical/*.vb" />
<include name="${project::get-base-directory()}/${project::get-name()}/Modules/*.vb" />
<include name="${project::get-base-directory()}/${project::get-name()}/My Project/*.vb" />
</sources>
<resources prefix="APP3" dynamicprefix="true">
<include name="${project::get-base-directory()}/${project::get-name()}/*.resx" />
<include name="${project::get-base-directory()}/${project::get-name()}/My Project/*.resx" />
</resources>
<references>
<include name="Microsoft.VisualBasic.dll" />
<include name="System.dll" />
<include name="System.Data.dll" />
<include name="System.Windows.Forms.dll" />
<include name="System.configuration.dll" />
<include name="System.Drawing.dll" />
<include name="${build.dir}/APP3_DataClasses.dll" />
<include name="${build.dir}/classUtilities.dll" />
<include name="System.Xml.dll" />
<include name="C:\Dev\NHibernate-2.1.2\Required_Bins\Iesi.Collections.dll" />
<include name="C:\Dev\NHibernate-2.1.2\Required_Bins\NHibernate.dll" />
<include name="C:\Dev\NHibernate-2.1.2\Required_Bins\log4net.dll" />
<include name="C:\Dev\LumenWorks.Framework\LumenWorks.Framework.3.8.0\LumenWorks.Framework.IO.dll" />
<include name="C:\Program Files (x86)\Microsoft Visual Studio 9.0\Visual Studio Tools for Office\PIA\Office11\Microsoft.Office.Interop.Word.dll" />
</references>
</vbc>
</target>
I faced the same problem, and then tested each of the assemblies with the program .NET Reflector I've discovered that when a program is compiled from the VS, a resource file Properties\Resources.resx in the assembly has a name appName.Properties.Resources.resources. When you use nAnt
<resources>
<include name="${proj_dir}/Properties/Resources.resx"/>
</ resources>
in the assembly resource file has name Resources.resources .
I solved this problem as follows.
<target name="example">
<copy file="${proj_dir}/Properties/Resources.resx" tofile="${proj_dir}/Properties/appName.Properties.Resources.resx"/>
<csc target="winexe" output="${bin_dir}/appName.exe">
<sources>
<include name="${proj_dir}/*.cs"/>
<include name="${proj_dir}/Properties/*.cs"/>
</sources>
<resources>
<include name="${proj_dir}/Properties/appName.Properties.Resources.resx"/>
</resources>
</csc>
<delete file="${proj_dir}/Properties/appName.Properties.Resources.resx"/>
</target>