473,789 Members | 3,123 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 4969
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
5862
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
12091
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
1557
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
13208
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
9511
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,...
0
10408
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10199
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10139
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
9020
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7529
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5417
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4092
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
3697
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.