Hello, everybody.

Until recently, I've done my .NET development in MS Visual Studio .NET.
These days, I am creating NAnt scripts for my solutions. Everything worked
great except the resource files in GUI projects: whenever I started a GUI
application, an exception would be thrown, claiming that a resource could
not be loaded.

I've researched the problem, and here's what I've discovered: GUI forms
created by VS.NET load form's resources using a call

  System.Resources.ResourceManager resources =
    new System.Resources.ResourceManager(
      typeof(RQuantAboutDialog));

This actually attempts to load a resource whose name is
"Fully.Qualified.Class.Name.resources" from the assembly.

One solution to the problem is to first compile the resources, one by one,

  <resgen input="rqme/rqme.resx" output="rqme/rqme.resources"/>

and then pass them to C# compiler using

  <csc ...>
    ...
    <arg value="/resource:rqme/rqme.resources,RQuant.rqme.rqme.resources"/>
    ...
  </csc>

(Note the "RQuant.rqme" in the resource identifier after the comma... this
is because the namespace must also be included, as described above.)

This approach is somewhat cumbersome, because all resource files have to be
enumerated explicitly... twice.

Ideally, the <resources> tag would accept additional parameters (the
prefix), so that the above effect could have been achieved by NAnt XML like

  <csc ...>
    ...
    <resources basedir="rqme" prefix="RQuant.rqme.">
      <includes name="*.resx"/>
    </resources>
    ...
  </csc>

Here, <resources> is a FileSet with an additional parameter (the prefix).
Additionaly, the csc task would automatically invoke resgen to convert
*.resx resources into *.resources.

Are there any alternative suggestions? How hard would it be to implement the
one proposed here?

Cheers,
  Klemen.



-------------------------------------------------------
This sf.net email is sponsored by: OSDN - Tired of that same old
cell phone?  Get a new here for FREE!
https://www.inphonic.com/r.asp?r=sourceforge1&refcode1=vs3390
_______________________________________________
Nant-developers mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/nant-developers

Reply via email to