0

is it possible to run a C# project Already build using another project? there is any way to invoke the c# execution using a c# Code.

In here I need to execute the Already Compile Project inside a another project.

ish1104
  • 401
  • 4
  • 19
  • I think you need to elaborate on this a little. Do you want to call methods in another project which is simply a case of referencing the project and using its methods, or do you want to run an already compiled exe using Process.Start? – Steve Harris Apr 15 '21 at 08:28
  • I need to run already compiled exe using another project. – ish1104 Apr 15 '21 at 08:29
  • 1
    Sounds like you'd rather would want to refactor to have this common functionality in a lib instead of an exe. – Filburt Apr 15 '21 at 08:33
  • Possible [duplicate](https://stackoverflow.com/q/9679375/1997232). – Sinatr Apr 15 '21 at 08:45

1 Answers1

1

You can run an exe using Process.Start

ProcessStartInfo ps = new ProcessStartInfo("YourExecutable.exe", "any arguments");
ps.WindowStyle = ProcessWindowStyle.Hidden; // or exclude this line to show it
ps.CreateNoWindow = true; // and this line
ps.UseShellExecute = false;

Process process = new Process();
process.StartInfo = ps;

process.Start();

There are additional ways to get the output of your process for displaying or logging but that is easily searchable.

Steve Harris
  • 5,014
  • 1
  • 10
  • 25