问题
I am looking to create and call a reference to a compiled .net exe file in a c# program and spawn it from my C# while outputting a single .exe.
Is this possible or am I wasting my time?
回答1:
I'm not sure if it is what you need, but you can reference any dotnet exe just as you would reference a dll. The target platform (x86, x64) must be the same if set in the referenced exe.
回答2:
You might be looking for the Process.Start:
Process myProc;
// Start the process.
myProc = Process.Start("C:\path\to\yourexecutable.exe");
//The process does something.
//...
// Stop the process.
myProc.CloseMainWindow();
However, I'm not following on the "embed" part. What are you trying to embed? What does "outputting a single .exe" mean?
回答3:
This might of some interest to you :
http://blogs.msdn.com/b/microsoft_press/archive/2010/02/03/jeffrey-richter-excerpt-2-from-clr-via-c-third-edition.aspx
来源:https://stackoverflow.com/questions/8068013/embed-and-reference-an-exe-in-c-sharp