473,395 Members | 1,595 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

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

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
3 4935
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Cindy Liu | last post by:
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...
1
by: Gabriel Lozano-Morán | last post by:
First of all sorry for the cross-posting but I am not sure wether this belongs under internationalization or just general. Environment: Visual Studio .NET 2003 Problem: Newly added and...
5
by: Drew | last post by:
Assembly asm = Assembly.GetExecutingAssembly(); me = new Bitmap(asm.GetManifestResourceStream("me.gif")); I have used this before without any problem, but now I get: An unhandled exception...
4
by: Jason Pettys | last post by:
In an ASP.NET project I am setting the content type of my .ascx and ..aspx files to Embedded Resource for a separate reason. When I do this they get embedded as "RootNamespace.Filename" but I...
0
by: Kleanthis | last post by:
I have a problem, when deploying multilingual applications using cab files on Compact Framework 2.0. It seems that something is going wrong with compact framework 2.0 Below I have a description...
6
by: cql90 | last post by:
Hi All, I have created a folder call Resource within my project, I have added a XML file into the resource folder, and I set the BuildAction property of the XML file to "Embedded Resource". How...
8
by: John Dunn | last post by:
Since currently we aren't allowed to have compiled XAML files embedded in C++ apps I'm using Markup::XamlReader::Load to dynamically load XAML files. This works perfectly fine with external files...
3
by: Samuel Shulman | last post by:
I get the following error: The website is compiled and published!! Server Error in '/ABCMainTest' Application....
8
by: Rob T | last post by:
When I was using VS2003, I was able to compile my asp.net project locally on my machine and copy it to the production server and it would run just fine. I've now converted to VS2005. The project...
1
by: Ryan Liu | last post by:
"j1mb0jay" <j1mb0jay@uni.ac.ukдÈëÏûÏ¢ÐÂÎÅ:s0dmg5x4el.ln2@news.aber.ac.uk... Thanks, j1mbjay. Then what is the difference betweeen "Content" and "Embedded"? What is the difference between...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.