Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / C# / November 2006

Tip: Looking for answers? Try searching our database.

Embedded Resource Files

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
doomsday123@gmail.com - 22 Nov 2006 13:25 GMT
Is there an easy way to copy an Embedded Resource file to the file
system? I have a config file that is an Embedded Resource in my project
that I want to copy to a location in the file system but the only way I
can think of doing it is to read it and then create a new file and
write to the file.
Shailen Sukul - 22 Nov 2006 22:26 GMT
Get the resource stream by using Stream s =
System.Reflection.Assembly.GetExecutingAssembly().GetManifestResourceStream("myResource");

Then simply write the Stream to the files system, using the correct extension!

Hope the helps.
Signature

Good luck!

Shailen Sukul
Architect
(BSc MCTS, MCSD.Net MCSD MCAD)
Ashlen Consulting Service P/L
(http://www.ashlen.net.au)

> Is there an easy way to copy an Embedded Resource file to the file
> system? I have a config file that is an Embedded Resource in my project
> that I want to copy to a location in the file system but the only way I
> can think of doing it is to read it and then create a new file and
> write to the file.
Laurent Bugnion - 23 Nov 2006 07:59 GMT
Hi,

> Get the resource stream by using Stream s =
> System.Reflection.Assembly.GetExecutingAssembly().GetManifestResourceStream("myResource");
>
> Then simply write the Stream to the files system, using the correct extension!

Or, to simplify the extension thing, simply save the file in the
resources using the extension already.

And remember that the path in the resources is separated with dots, not
slashes.

myAssembly.GetManifestResourceStream("myFolder.myResource.jpg");

HTH,
Laurent
Signature

Laurent Bugnion, GalaSoft
Software engineering: http://www.galasoft-LB.ch
Private/Malaysia: http://mypage.bluewin.ch/lbugnion
Support children in Calcutta: http://www.calcutta-espoir.ch

Shailen Sukul - 24 Nov 2006 05:09 GMT
I have posted an example on my blog at:
http://geekswithblogs.net/shailensukul/archive/2006/11/24/97962.aspx
It can save a text based stream to the file system.

HTH
Signature

Good luck!

Shailen Sukul
Architect
(BSc MCTS, MCSD.Net MCSD MCAD)
Ashlen Consulting Service P/L
(http://www.ashlen.net.au)

> Is there an easy way to copy an Embedded Resource file to the file
> system? I have a config file that is an Embedded Resource in my project
> that I want to copy to a location in the file system but the only way I
> can think of doing it is to read it and then create a new file and
> write to the file.

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.