Hi Mateusz, If you want to have manifest resource names that match those generated by VS.NET, you should avoid usign <resgen>.
Instead, you should use the <resources> element of the individual compiler tasks and have the compiler task do the resource compilation (and generation of the manifest resource names) for you. In your case, your "build" target can be reduced to this (or something very similar) : <target name="build" description="Builds current configuration"> <echo message="Build Directory is ${build.dir}" /> <!-- prepare build directory --> <mkdir dir="${build.dir}/bin" /> <!-- copy libraries --> <copy todir="${build.dir}/bin"> <fileset basedir="lib"> <include name="*.dll" /> </fileset> </copy> <csc target="winexe" warnaserror="true" debug="${build.debug}" output="${build.dir}/bin/${project.name}.exe" win32icon="App.ico"> <references basedir="${build.dir}"> <include name="System.dll" /> <include name="System.Data.dll" /> <include name="System.Drawing.dll" /> <include name="System.Windows.Forms.dll"/> <include name="System.XML.dll" /> <include name="lib/*.dll" /> </references> <sources basedir="src"> <include name="**/*.cs" /> </sources> <resources basedir="src" prefix="<SET THIS TO THE DEFAULT NAMESPACE OF THE C# PROJECT>" dynamicprefix="true"> <include name="**/*.resx" /> <include name="**/*.bmp" /> </resources> </csc> </target> Note: you still need to replace the value of the prefix attribute of the <resources> element with the "Default namespace" as set in your C# project. Hope this helps, Gert PS. I added a note to the task docs on this, which should appear online when I upload the next nightly build. > -----Original Message----- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf Of > Mateusz Loskot > Sent: zaterdag 4 december 2004 2:12 > To: [EMAIL PROTECTED] > Subject: [Nant-users] WinForms, Images, Resources > > Hello, > > I've just started to use NAnt and try to port > my applications to this build tool. > Everything works great besides one "small" thing ;-))) > Apps built by NAnt does not launch and I get some exceptions. > I know what is going on, I made quite long investigation > and the problem is that my application uses some images embedded in > resources and dislay it in controls but those images are not > properly embedded in my application binary so it > can not find it. > > Here is my buildfile (details are explained below the buildfile).: > > ######################################################### > <?xml version="2.0" encoding="UTF-8" ?> > <project name="NAntTest" default="build"> > > <property name="project.name" value="NAntTest" /> > <property name="project.version" value="1.0.0" /> > > <property name="build.debug" value="true"/> > <property name="build.dir" value="${nant.project.basedir}/build" /> > <property name="lib.dir" value="${nant.project.basedir}/lib" /> > <property name="pixmaps.dir" > value="${nant.project.basedir}/pixmaps" /> > > <target name="clean" description="Removes all generated files"> > <if test="${directory::exists(build.dir + '/bin')}"> > <delete dir="${build.dir}/bin" verbose="true" > failonerror="false" /> > </if> > </target> > > <target name="debug" depends="clean"> > <property name="build.debug" value="true"/> > </target> > > <target name="release" depends="clean"> > <property name="build.debug" value="false"/> > </target> > > <target name="build" description="Builds current configuration"> > <echo message="Build Directory is ${build.dir}" /> > > <!-- prepare build directory --> > <mkdir dir="${build.dir}/bin" /> > > <!-- copy libraries --> > <copy todir="${build.dir}/bin"> > <fileset basedir="lib"> > <include name="*.dll" /> > </fileset> > </copy> > > <resgen todir="${build.dir}/bin"> > <resources> > <include name="src/Form1.resx" /> > </resources> > </resgen> > > <csc target="winexe" warnaserror="true" debug="${build.debug}" > output="${build.dir}/bin/${project.name}.exe"> > > <references basedir="${build.dir}"> > <include asis="true" name="System.dll" /> > <include asis="true" name="System.Data.dll" /> > <include asis="true" name="System.Drawing.dll" /> > <include asis="true" name="System.Windows.Forms.dll"/> > <include asis="true" name="System.XML.dll" /> > <include name="lib/*.dll" /> > </references> > > <sources> > <include name="src/*.cs" /> > </sources> > > <resources prefix="" dynamicprefix="true"> > <include name="Form1.resources" /> > </resources> > > <arg value="/resource:${build.dir}/bin/Form1.resources" > /> <arg > value="/resource:customLogo.bmp,customLogo.bmp.bmp" /> > <arg > value="/resource:App.ico,App.ico" /> > > </csc> > </target> > > </project> > ######################################################### > > > In my Form1.cs I use images like this one: > > // in class ctor > this.pictureBox1.Image = new Bitmap(typeof(Form1), "customLogo.bmp"); > > > I use <resgen> to compile Form1.resx in src directory: > > <resgen todir="${build.dir}/bin"> > <resources> > <include name="src/Form1.resx" /> > </resources> > </resgen> > > Then I include the resource file generated. > I'm not sure if I should to this using resource tag: > > <resources prefix="" dynamicprefix="true"> > <include name="Form1.resources" /> > </resources> > > or using <arg> declaration only like this: > > <arg value="/resource:${build.dir}/bin/Form1.resources" /> > <arg > value="/resource:customLogo.bmp,customLogo.bmp" /> > <arg > value="/resource:App.ico,App.ico" /> > > Should I also include App.ico and customLogo.bmp as > <resources> childs > (includes) ? > > I browsed through the nant-users archives and I read all resources > related posts till year 2003 ;-))) and I didn't find any helpful > information. I tested all hints I found but they didn't help me. > > My question is: > > How to embed imaged in the app (exe) resources just like I do > it using VS .NET? > > I use NAnt today nightly build. > > Best regards > > -- > Mateusz Łoskot, mateusz (at) loskot (dot) net > Registered Linux User #220771, Debian (Sarge) > > > ------------------------------------------------------- > SF email is sponsored by - The IT Product Guide > Read honest & candid reviews on hundreds of IT Products from > real users. > Discover which products truly live up to the hype. Start reading now. > http://productguide.itmanagersjournal.com/ > _______________________________________________ > Nant-users mailing list > [EMAIL PROTECTED] > https://lists.sourceforge.net/lists/listinfo/nant-users > > ------------------------------------------------------- SF email is sponsored by - The IT Product Guide Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now. http://productguide.itmanagersjournal.com/ _______________________________________________ Nant-users mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/nant-users