PC Review


Reply
Thread Tools Rate Thread

How to get to embedded resources from assemblies?

 
 
Guest
Posts: n/a
 
      19th Dec 2003
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.


 
Reply With Quote
 
 
 
 
Pete Davis
Guest
Posts: n/a
 
      19th Dec 2003
You can get the stream as follows:

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

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

Pete

<(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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.
>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Setup Error Failed to lad resources from resources file Please check your setup spielmann Microsoft Dot NET Framework 0 14th Apr 2005 01:39 PM
How to get embedded resources from any namespace in project? =?Utf-8?B?RWQ=?= Microsoft Dot NET Framework Forms 0 25th Jan 2005 12:27 AM
.resources generated by .NET and creating your own Example2.resources.dll Derick Smith Microsoft VB .NET 0 15th Oct 2004 03:54 PM
Re: Embedded resources in DLL not working jennyq Microsoft Dot NET Framework 1 19th Aug 2003 08:15 PM
Embedded resources and extended namespaces Philipp Seidel Microsoft Dot NET Framework 1 29th Jul 2003 11:52 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 03:53 AM.