By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
448,967 Members | 1,596 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 448,967 IT Pros & Developers. It's quick & easy.

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

P: n/a
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

Nov 22 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
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().GetManifestResourc eNames())
{
Console.WriteLine(aResourceName);
}

Christian

---

"Cindy Liu" <Ci******@discussions.microsoft.com> wrote in message
news:D9**********************************@microsof t.com...
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

Nov 22 '05 #2

P: n/a
The name of the resource will change now that you have put it in a
folder. The name of the resource will now be <default
namespace>.<folder>.<file>.resources

or you can check out the name of the resource by using the IL
Disasembler (ILDasm.exe) , the resources will be in a .mresources section.

This article will be useful
http://msdn.microsoft.com/vcsharp/us...ms02202003.asp

Sijin Joseph
http://www.indiangeek.net
http://weblogs.asp.net/sjoseph

Cindy Liu wrote:
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

Nov 22 '05 #3

P: n/a
The name of the resource will change now that you have put it in a
folder. The name of the resource will now be <default
namespace>.<folder>.<file>.resources

or you can check out the name of the resource by using the IL
Disasembler (ILDasm.exe) , the resources will be in a .mresources section.

This article will be useful
http://msdn.microsoft.com/vcsharp/us...ms02202003.asp

Sijin Joseph
http://www.indiangeek.net
http://weblogs.asp.net/sjoseph

Cindy Liu wrote:
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

Nov 22 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.