473,396 Members | 2,018 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,396 software developers and data experts.

How to get to embedded resources from assemblies?

I have an XML file that I want to embed in my exe. It is a default config
file, that my program should read from and recreate it on the user's hard
disk the first time the application is run or if they corrupt their config
file.

So I created a default.config file (XML file) and set its Build Action
property to "Embedded Resource".

What is the code to read the embedded default.config and recreate it on the
user's hard disk?

Thanks.
Nov 15 '05 #1
1 17930
You can get the stream as follows:

Stream inFile =
Assembly.GetExecutingAssembly().GetManifestResourc eStream("YourNameSpace.You
rXmlFileName.xml");

From here, you simply need to create an output stream and copy the data.

Pete

<an*******@discussions.microsoft.com> wrote in message
news:e2**************@TK2MSFTNGP11.phx.gbl...
I have an XML file that I want to embed in my exe. It is a default config
file, that my program should read from and recreate it on the user's hard
disk the first time the application is run or if they corrupt their config
file.

So I created a default.config file (XML file) and set its Build Action
property to "Embedded Resource".

What is the code to read the embedded default.config and recreate it on the user's hard disk?

Thanks.

Nov 15 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Philipp Seidel | last post by:
Hi there! I did not know, where this topic fits in, so I put it here. I have a minor problem with embedded resources, which puzzles me quite a lot. I'd be glad if anyone can help me on this: ...
0
by: StefanT | last post by:
Hi, there is any way to change some embedded resources at runtime ? I can pull resources from an assembly at runtime but there is any way to change this resources as well. Best regards,...
1
by: Vanessa | last post by:
Anyone know how to embed sound file to vb.net project, then play the sound file? I have searched the web for example... and download the example and when run, it works perfectly. But when i...
0
by: schoenfeld1 | last post by:
If I have an executable with a gigabytes of embedded resources, will the CLR loader try to load the resources into memory or does it only load the code segments? The reason I ask is because I am...
5
by: Bob Rock | last post by:
Hello, I'd like to be able to enumerate resources in embedded .resources files like it is possible with external .resources files using the ResourceReader class. Is there a way to do such a...
0
by: Kyle Kaitan | last post by:
Is there a managed way to both read from *and* write to embedded resources?
0
by: PontiMax | last post by:
Hi, 'til now my resource files did simply consist of string entries. Now I intend to use images as embedded resources. How can that be done? Do I have to use a resource editor? The...
1
by: thomson | last post by:
Hi all, I have added a new Item in my Solution Test.sql which has got some sql scripts and i have changed the Build Action Property of the file to embedded Resources private string...
2
by: Dan | last post by:
Hi, How do I embed a picture (gif for instance) in a dll using VB.NET so that the picture can be used in a html page with the res protocol? I have tried adding pictures (as Embedded resources)...
4
by: Bob Rock | last post by:
Hello, I'd like to programmatically access keys and values of on .resources file embedded in my assembly. I've seen that the assembly class provides the GetManifestResourceStream method .......
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
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...
0
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,...
0
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...
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...
0
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,...

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.