In my application I compile another program from source.cs file using CodeDom.Compiler and I embed some resources ( exe and dll files ) at compile time using :
Keep in mind that Embedded resource filename = Assemblyname.fileName
string fileName = "test.pdf";
System.Reflection.Assembly a =
System.Reflection.Assembly.GetExecutingAssembly();
string fileName = a.GetName().Name + "." +
"test.pdf";
using (Stream resFilestream =
a.GetManifestResourceStream(fileName))
{
if (resFilestream == null) return null;
byte[] ba = new
byte[resFilestream.Length];
resFilestream.Read(ba, 0, ba.Length);
var byteArray= ba;
}