How to load xml resource file under a folder in a .Net project

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,

If my xml resource file is directly under my project file, I have no problem
to load that xml file via Assembly.GetManifestResourceStream. However, after
I create a folder under the project and move my xml file under that folder, I
cannot load that xml file via Assembly.GetManifestResourceStream. Every time
it returns null. Any idea?

Thanks in advance!!!
Cindy
 
Are you using Visual Studio? It uses the folder name as prefix of the
resource name.

You can see what embedded resources are in your assembly like this:

foreach (string aResourceName in
Assembly.GetExecutingAssembly().GetManifestResourceNames())
{
Console.WriteLine(aResourceName);
}

Christian
 

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

Back
Top