A new project, such as packexe, uses the external file f.exe as the embedded resource,
Add code:
Using System. reflection; // ++ using System. IO; namespace packEXE {// <summary> // MainWindow. interaction logic of xaml // </summary> public partial class MainWindow: Window {public MainWindow () {InitializeComponent (); // MessageBox. show (System. IO. path. getFileNameWithoutExtension (System. IO. path. getTempFileName (); String projectName = Assembly. getExecutingAssembly (). getName (). name. toString (); using (var stream = Assembly. getExecutingAssembly (). getManifestResourceStream (projectName + ".f.exe") {Byte [] B = new Byte [stream. length]; stream. read (B, 0, B. length); string s = System. IO. path. getTempPath () + "f.exe"; if (File. exists (s) File. delete (s); using (FileStream f = File. create (s) {f. write (B, 0, B. length );}}}}}
After that, you can use the f.exe file as you like. You can delete the file without any trace. (Author: yijian)
Of course, if you are an. net EXE file, you can use a simpler method to embed the call. For more information, see "embed Dll into WPF ".