#243 solution task: namespace prefixing wrong on resources

Tasks (408)


<solution> task, C# winforms project.

The RootNamespace shouldn't get prefixed onto
winforms' .resx resources -- it should be made to match
the namespace of the corresponding form/control class.

NAnt usually gets this right (kudos!) but slips up if the
form-derived class isn't in any namespace.

Repro steps:

- start VS2003, create new winforms project (C#)

- project props: change default namespace
from "WindowsApplication1" or whatever
to "DefaultNamespace".

- Form1 properties: set Localizable=true, in order to
generate dependency on resx file.

- edit Form1.cs: remove the outer namespace
declaration ("WindowsApplication1") so that the form
class is declared at the top level (not in any namespace)

- compile (w/ VS)

- inspect WindowsApplication1.exe with ildasm or
whatever; note presence of resource:

.mresource public Form1.resources

- add a bmp or jpg file or something to the project, as
an Embedded Resource; recompile, and inspect w/
ildasm. You'll get something like this:

.mresource public Form1.resources
.mresource public DefaultNamespace.Sunset.jpg

- now, rebuild all w/ NAnt <solution> task, and note the
difference in naming:

.mresource public DefaultNamespace.Form1.resources
.mresource public DefaultNamespace.Sunset.jpg

- the resulting app will crash upon startup
because it can't find "Form1.resources"!


  • Gert Driesen

    Gert Driesen - 2004-12-04
    • assigned_to: nobody --> drieseng
  • Gert Driesen

    Gert Driesen - 2004-12-05
    • status: open --> closed-fixed
  • Gert Driesen

    Gert Driesen - 2004-12-05

    Logged In: YES

    This issue is now fixed in cvs.

    Thanks for the report !!


Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

No, thanks