OT: nant build help on resource embedding

13 views
Skip to first unread message

goodwill

unread,
Nov 17, 2007, 11:04:26 AM11/17/07
to Castle Project Users
Sorry to throw a not castle related topic here as I don't know where I
could find help.

I am trying to use a vCard library here:
http://www.thoughtproject.com/Libraries/vCard/

In order to make my testing and build process more smooth I have
written a build script, here are the related target code:
<target name="build-test" depends="init-properties">

<copy todir="${build.test.dir}" >
<fileset basedir="${build.bin.dir}">
<include name="**/*.dll"/>
<include name="**/*.pdb"/>
<include name="**/*.xml"/>
<include name="**/*.dll"/>
</fileset>


</copy>
<copy todir="${build.test.dir}">
<fileset basedir="${sharedlib.dir}">
<include name="NUnit.Framework.*"/>
</fileset>
</copy>

<csc debug="${isdebug}" output ="${build.test.file}"
target="library">
<resources basedir="${test.source}" prefix="${project::get-
name()}.UnitTests" dynamicprefix="true" >
<include name="*.resx" />
</resources>
<sources basedir ="${test.source}">
<include name="**/*.cs"/>

</sources>

<references>
<include name="${build.test.dir}\**\*.dll"/>

</references>
</csc>

</target>
<target name="build-bin" depends="init-properties">
<echo message="Debug: ${isdebug}"/>
<copy todir="${build.bin.dir}">
<fileset basedir="${sharedlib.dir}">
<!-- we reserve this for future reference-->
</fileset>
</copy>
<csc debug="${isdebug}" output ="${build.bin.file}"
target="library">

<sources basedir ="${main.source}">
<include name="**/*.cs"/>

</sources>
<resources basedir="${main.source}" prefix="${project::get-name()}"
dynamicprefix="true">
<include name="*.resx" />
</resources>
<references>
<include name="${build.bin.dir}\**\*.dll"/>

</references>
</csc>
</target>

When I try to run the test, the test has failed with errors on unable
to retrieve resource embedded inside the test project. Is there any
parameter missing in order to make resources embed properly inside the
dll?

josh robb

unread,
Nov 17, 2007, 12:18:03 PM11/17/07
to castle-pro...@googlegroups.com
On Nov 17, 2007 4:04 PM, goodwill <william....@gmail.com> wrote:
> When I try to run the test, the test has failed with errors on unable
> to retrieve resource embedded inside the test project. Is there any
> parameter missing in order to make resources embed properly inside the
> dll?

goodwill,

Open up your assembly in either ildasm or Reflector and check what the
actual names of the embedded resources are vs what names your using to
try and load them.

Most of the time the problem is that I'm using:

MyNameSpace.Sub.Resource.jpg
and it's been embedded as
Mynamespace.sub.somethingelse.Resource.jpg

j.

goodwill

unread,
Nov 17, 2007, 12:30:17 PM11/17/07
to Castle Project Users
Josh,
The problem is it works when I compile using VS2005 :/ I think thats
my novice on nant cause this problem as the assembly is not required
to be signed, so it should not be the multi-locale resource problem in
nant.

If you want to see the source leave me a msg:) I would be very happy
if you could offer me a hand on this :)
William

On Nov 18, 1:18 am, "josh robb" <josh_r...@fastmail.fm> wrote:

goodwill

unread,
Nov 17, 2007, 12:44:01 PM11/17/07
to Castle Project Users
Josh,
No more need to bother you- your hint saved all my hairs :) I realize
the project has a very interesting non-conformance on the namespaces
naming, instead of naming it the same as the assembly, it is just a
simple Tests, thus the default compile result gives wrong namespace.
William

josh robb

unread,
Nov 17, 2007, 1:03:10 PM11/17/07
to castle-pro...@googlegroups.com
Glad I could help save your hair! ;)

Have a good weekend.

j.

Reply all
Reply to author
Forward
0 new messages