Are you looking to extract the embbedded files from the exe to extract when
your exe launches?.. If the answer is yes... then here is what you do... in
your code at you can do this..
string includeFileName = "MyApplication.MySapce.Trial.jpg";
string strNewPathToSave = @"C:\MyNewPath\Trial.jpg";
System.IO.Stream myFile
= System.Reflection.Assembly.GetManifestResourceStream(includeFileName);
if ( myFile== null )
return "Unable to read the License file."; //"Inspherion License file is
not valid. Please contact Inspherion Support";
System.IO.FileStream fs = System.IO.File.OpenWrite(strNewPathToSave);
try
{
// Save the File...
byte[] buffer = new byte[myFile.Length];
myFile.Read(buffer,0,(int)myFile.Length);
fs.Write(buffer,0,buffer.Length);
}
finally
{
fs.Close();
}
Remeber that.. the includeFileName has to be fully qualified with Namespace
used by the executable or assembly where the file is embbeded.
HTH
VJ
[quoted text, click to view] "Zagor" <zagor@rogers.com> wrote in message
news:uHLDOliSGHA.224@TK2MSFTNGP10.phx.gbl...
> Hi All,
> I have a small exe app ( basic a dialog box) that when lauched needs to
> "copy" some files in a directory chosen by the user (within the dialog). I
> cannot use an installation package because there are some particular tasks
> to be done from the exe.
> Anyhow I was wondering if it possibile to include files within the (C#)exe
> and then extract them from the exe when launched...sort of an
> installation.
> I was thinking to add them as resources but I do not know how to extract
> them.
>
> Please any hint will be appreciated
>
> Thank you
> Zagor
>