Bert, Try this build fragment :
<?xml version="1.0"?> <project default="build" name="ConsoleApplication1"> <property name="build.debug" value="true" /> <target name="build"> <!-- build main assembly --> <mkdir dir="bin" /> <csc debug="${build.debug}" output="bin\ConsoleApplication1.exe" target="exe" win32icon="App.ico"> <sources> <include name="**/*.cs" /> </sources> <resources dynamicprefix="true" prefix="ConsoleApplication1"> <include name="**/*.resx" /> </resources> <references> <include name="System.dll" /> <include name="System.Data.dll" /> <include name="System.XML.dll" /> </references> </csc> </target> </project> Dit zou zeker moeten werken ! Gert ----- Original Message ----- From: "Bert Jan Lappenschaar" <[EMAIL PROTECTED]> To: "Gert Driesen" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> Sent: Monday, August 02, 2004 5:01 PM Subject: RE: [Nant-users] default resources in assembly files Ok, I found a solution for this problem. I added a very simple example solution to this email demonstrating the issue. It is an console application. It has 1 class, ConsoleApplication1. It has 1 resource file, Resource1.resx, which contains 1 resource string, "testString". The console applicaton creates a resourcemanager based on this resource file and writes the string to Console using the following code: ResourceManager rm = new ResourceManager("ConsoleApplication1.Resource1", typeof(Class1).Assembly); Console.WriteLine(rm.GetString("testString")); Note that the resource file is loaded using the root name "ConsoleApplication1.Resource1". this name consists of the Default namespace for this project (this can be found in de cs.proj file, in this case it is "ConsoleApplication1" ) and the base name of the resource file, which is "Resource1"). If you compile the project using Visual Studio, the resx file "Resource1.resx" will be compiled to a binary resource file "ConsoleApplication1.Resource1.resources" which is than linked into the exe. So if I want my Nant script to do exactly the same, I have to use a NAnt copy Task to copy the resx file to a new resx file that has the correct name (which includes the default name space). I then compile the exe using the new resx file. In that way, I can load the the resource file in the resource manager using the code above. If I don't rename the resx file before compiling, it will have a different root name. Copy task: <copy file="D:\temp\ConsoleApplication1\Resource1.resx" tofile="D:\temp\ConsoleApplication1\ConsoleApplication1.Resource1.resx" /> See included nant script in the attached zip file. In this way I end up with my resources compiled exactly (at least as far as I can see) the way Visual Studio compiles them... Thanks Bert-Jan -----Oorspronkelijk bericht----- Van: Gert Driesen [mailto:[EMAIL PROTECTED] Verzonden: zondag 1 augustus 2004 16:15 Aan: Bert Jan Lappenschaar; [EMAIL PROTECTED] Onderwerp: Re: [Nant-users] default resources in assembly files Bert, Can you send us a small repro for this issue ? Don't send us your solution as is, but create a clean solution with the minimum set of files necessary to reproduce this issue. Thanks, Gert ----- Original Message ----- From: "Bert Jan Lappenschaar" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Friday, July 30, 2004 12:25 PM Subject: [Nant-users] default resources in assembly files Hi all, Thanks for your help so far, very useful! I ran into another thing: I compiled the same website using Visual Studio and using a nant script. I compared the dll and its satellite dll's with the Loetz Roeder's resource tool to see what resources are in there and what the names of the binary resource files in the DLL's are. The satellite assemblies are identical so that's fine. But there are differences in the main dll's: The names of the included binary resource file differ: The Visual Studio build uses the name of the class that the resource belongs to. Example: phw842_frm1.ascx.nl.resx belongs to phw842_frm1.ascx.cs (In Visual Studio, the is represented by the fact that this resx file 'hangs' under the ascx file and in the csproj file this is specified in the 'DependantUpon attribute. My nant build turns this resx file into phw842_frm1.Resources (resource file name is based on resx file name) and adds it to the dll). But the Visual Studio build turns this resx file into phw842_1.Resources (resource file name is based on the classname in the code file the resx belongs to (this class name differs from the name of the code file!)) and adds it to the .dll. The result is that resource managers in the code who try to load the binary resource file phw842_1.Resources by using the type of the class, won't find it. How can I change my CSC task so it includes resource files with names that are base on class names (types) instead of resx file names? The way I compile the files in Nant is by just listing all resx files in a resources node (see below example code), I guess I have to somehow specify the links between code files and resource files so Nant can figure out the names for the binary resource files? Note that for the satellite assemblies, I parsed the csproject files and code files with a program I wrote myself to get to the classenames (types) that must be used for the names of the .resource files. Thanks, Bert-Jan Example: <csc failonerror="false" debug="${build.debug}" warnaserror="true" output="H:\BuildDepot\Pharos\DevelopmentVersion\Nantbuild\phw842\bin\phw 842.dll" target="library"> <sources> <includes name="BuildAssemblyInfo.cs" /> <includes name="Global.asax.cs" /> <includes name="PharosCorner.aspx.cs" /> <includes name="PharosHeader.aspx.cs" /> <includes name="phw842_frm0.aspx.cs" /> <includes name="phw842_frm1.ascx.cs" /> <includes name="phw842_frm1.aspx.cs" /> <includes name="phw842_frm2.ascx.cs" /> <includes name="phw842_frm2.aspx.cs" /> <includes name="phw842_frm3.ascx.cs" /> <includes name="phw842_frm3.aspx.cs" /> <includes name="phw842_frm4.ascx.cs" /> <includes name="phw842_frm4.aspx.cs" /> <includes name="phw842_frm5.ascx.cs" /> <includes name="phw842_frm6.ascx.cs" /> <includes name="phw842_frm7.ascx.cs" /> <includes name="phw842_frm8.ascx.cs" /> <includes name="phw842_Main1.ascx.cs" /> <includes name="phw842_Main2.ascx.cs" /> <includes name="phw842_Main3.ascx.cs" /> <includes name="phw842_Main4.ascx.cs" /> </sources> <resources> <includes name="phw842_frm0.aspx.resx" /> <includes name="phw842_frm2.ascx.resx" /> <includes name="phw842_frm4.ascx.resx" /> <includes name="phw842_frm3.aspx.resx" /> <includes name="phw842_frm7.ascx.resx" /> <includes name="phw842_frm8.ascx.resx" /> <includes name="phw842_frm1.ascx.resx" /> <includes name="phw842_frm5.ascx.resx" /> <includes name="phw842_frm6.ascx.resx" /> <includes name="phw842_frm3.ascx.resx" /> <includes name="PharosCorner.aspx.resx" /> </resources> <references basedir="H:\BuildDepot\Pharos\DevelopmentVersion\Nantbuild\phw842\bin\"> <includes name="System.dll" /> <includes name="System.Drawing.dll" /> <includes name="System.Data.dll" /> <includes name="System.Web.dll" /> <includes name="System.Xml.dll" /> <includes name="phPersistentObjects.dll" /> <includes name="phKernel.dll" /> <includes name="phw842DB.dll" /> <includes name="CustomGridControl.dll" /> <includes name="CustomDisplayControl.dll" /> <includes name="phLibrary.dll" /> <includes name="DBITrace.NET.dll" /> </references> </csc> Bert-Jan Lappenschaar [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]> Senior ontwikkelaar DataBalk BV tel:+31318410135 mobiel: +31651093956 ------------------------------------------------------- This SF.Net email is sponsored by OSTG. Have you noticed the changes on Linux.com, ITManagersJournal and NewsForge in the past few weeks? Now, one more big change to announce. We are now OSTG- Open Source Technology Group. Come see the changes on the new OSTG site. www.ostg.com _______________________________________________ Nant-users mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/nant-users