embed resource file to output

J

Jeronimo Bertran

Hi,

I am writting an application that uses the ResourceManager to access
resources. For the default resource assembly I am trying to embed the
MyApp.resources file to the exe. If I do this on the command line:

csc /t:winexe /res:MyApp.resources /out:MyApp.exe MainForm.cs


Then it works fine.. I am able to read the resources by using the
ResourceManager:

rm = new ResourceManager("MyApp", this.GetType().Assembly);


However, I tried to embed the file using the Visual Studio environment....
I added the resource file to the project and I set the Build Action for the
file as Embedded Resource. When I run the program I get the following
exception when I try to read a resource...;


Unhandled Exception: System.Resources.MissingManifestResourceException:
Could not find any resources appropriate for the specified culture (or the
neutral culture) in the given assembly. Make sure "MyApp.resources" was
correctly embedded or linked into assembly "MyApp".


What am I doing wrong?

Thanks,

Jeronimo
 
L

Lloyd Dupont

hehehe...
I had the same problem.
the debugger and the command window is your friend!

then I discover each project has a default namespace and if you use a folder
it adds to the namespace.

for instance if you have a 'resources' directory and that the default
namespace is 'MyApp'
your resource should be accessed through

"MyApp.resources.MyApp" or "MyApp.resources.MyApp.resources" (prefereably
the former)

hopes this helps.....
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top