473,803 Members | 4,139 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.GetMan ifestResourceSt ream. 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.GetMan ifestResourceSt ream. Every time
it returns null. Any idea?

Thanks in advance!!!
Cindy

Nov 22 '05 #1
3 4971
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.GetExe cutingAssembly( ).GetManifestRe sourceNames())
{
Console.WriteLi ne(aResourceNam e);
}

Christian

---

"Cindy Liu" <Ci******@discu ssions.microsof t.com> wrote in message
news:D9******** *************** ***********@mic rosoft.com...
Hi,

If my xml resource file is directly under my project file, I have no
problem
to load that xml file via Assembly.GetMan ifestResourceSt ream. 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.GetMan ifestResourceSt ream. 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>.<fol der>.<file>.res ources

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.GetMan ifestResourceSt ream. 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.GetMan ifestResourceSt ream. 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>.<fol der>.<file>.res ources

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.GetMan ifestResourceSt ream. 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.GetMan ifestResourceSt ream. 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
492
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 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
1
5863
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 renamed resource files are not automatically linked to the object they belong by the IDE
5
8232
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 of type 'System.ArgumentException' occurred in system.drawing.dll Additional information: 'null' is not a valid value for 'stream'.
4
4430
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 would like them to be embedded as "RootNamespace.Folder.Filename". I see that the .resources files are embedded with the containing folder information in the namespace, and I think c# projects work this way, too. Is there any way (a vbc command...
0
2018
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 of the problem The main Smart Device Application contains 3 resource files under the Properties folder, in order to produce localization satellite asseblies. Those resource files are named Resources.resx (a default empty resource file),...
6
2688
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 can I retrieve its content in the runtime? Any help is deeply appreciated. Thanks you very much in advance. Kate
8
12092
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 but I'd like to be able to load a file specified in a .resx resource. I've added my .xaml file to the .resx and can load it in using ResourceManager::GetObject(). The object returned is a System::Array^ which contains System::Byte objects. The...
3
1558
by: Samuel Shulman | last post by:
I get the following error: The website is compiled and published!! Server Error in '/ABCMainTest' Application. -------------------------------------------------------------------------------- Parser Error Description: An error occurred during the parsing of a resource required to
8
13212
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 compiles & runs fine locally, but when I copy to the production machine, I get this error: Parser Error Message: Could not load type 'Global'. Source Error: Line 1: <%@ Application Codebehind="Global.asax.vb" Inherits="Global" %> Source...
1
6596
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 put a file in Resource (folder) or just in project? Thanks!
0
9699
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9562
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
10289
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10068
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6840
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5625
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4274
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3795
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2968
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.