public void Spawn(int ms) { try { const string logPrefix = "Test :>"; Console.WriteLine($"{logPrefix} Start {Process.GetCurrentProcess().Id}"); var info = ProcUtil.GetDotnetExeFullPath(); // or just use "dotnet" directly // start self // ========== var proc = Process.Start(info, $@"{ProcUtil.GetDllFullPath(this.GetType())} proc work {ms}"); //var proc = Process.Start(info,$@"{procUtil.GetDllFullPath()} proc dll") // start a different dll // ===================== //var proc = Process.Start(info, $@"I:\rp\git\CoreCmd\DependentConsoleApp\bin\Debug\netcoreapp3.1\DependentConsoleApp.dll demo progress-bar"); /** NOTE * If not call WaitForExit(), when the program will: * - execute asynchronously * - wait for console input to quit when the spawned process finishes ---> don't know why */ proc.WaitForExit(); Console.WriteLine($"{logPrefix} Finish"); } catch (Exception ex) { Console.WriteLine(ex.Message); } }
public void Dll() { Console.WriteLine(ProcUtil.GetDllDir()); Console.WriteLine(ProcUtil.GetDllFullPath(this.GetType())); Console.WriteLine(ProcUtil.GetDotnetExeFullPath()); }