Michael
Michael

Reputation: 545

Embed and reference an EXE in c#

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?

Upvotes: 2

Views: 6346

Answers (3)

Olivier Jacot-Descombes
Olivier Jacot-Descombes

Reputation: 112752

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.

Upvotes: 4

Kiril
Kiril

Reputation: 40395

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?

Upvotes: 2

Related Questions