Store files in C# EXE file

Posted by sublay on Stack Overflow See other posts from Stack Overflow or by sublay
Published on 2010-06-07T12:25:13Z Indexed on 2010/06/07 12:42 UTC
Read the original article Hit count: 181

Filed under:
|
|

It is actually useful for me to store some files in EXE to copy to selected location. I'm generating HTML and JS files and need to copy some CSS, JS and GIFs.

Snippet

System.IO.File.WriteAllBytes(@"C:\MyFile.bin", ProjectNamespace.Properties.Resources.MyFile);

doesn't work for me!

On "WriteAllBytes" it says: "cannot convert from 'System.Drawing.Bitmap' to 'byte[]'" for image and "cannot convert from 'string' to 'byte[]'" for text file.

Help!

© Stack Overflow or respective owner

Related posts about c#

Related posts about file