I'm trying to run same process as a child of current process. Showed below code works just fine under windows, but fails in Linux with error
No executable found matching command "dotnet-MyDll.dll"
var processInfo = new ProcessStartInfo
{
FileName = "dotnet",
Arguments = "MyDll.dll " + id.ToString()
};
Console.WriteLine("Starting child process...");
var process = Process.Start(processInfo);
return process;
Ive also tried FileName = "dotnet MyDll.dll"+ id.ToString(), but it ends up with different error Unhandled Exception: System.ComponentModel.Win32Exception: No such file or directory
I've also tried
var parentP = Process.GetCurrentProcess();
string fullPath = parentP.MainModule.FileName;
var command = fullPath+" "+Assembly.GetEntryAssembly().Location+" "+ id.ToString();
Console.WriteLine("Command = "+command);
var processInfo = new ProcessStartInfo
{
FileName = command
};
var process = Process.Start(processInfo);
Still Unhandled Exception: System.ComponentModel.Win32Exception: No such file or directory
I've also tried:
var parrentP = Process.GetCurrentProcess();
string fullPath = parrentP.MainModule.FileName;
var command = "\"" + fullPath + "\" " ;
var args = Assembly.GetEntryAssembly().Location + " " + id;
var processInfo = new ProcessStartInfo
{
FileName = command,
Arguments = args
};
var process = Process.Start(processInfo);
Exception No such file or directory
Exception at System.Diagnostics.Process.StartCore(ProcessStartInfo startInfo)
at System.Diagnostics.Process.Start()
at System.Diagnostics.Process.Start(ProcessStartInfo startInfo)
what is proper way of running currently running dll again under Linux with dotnet core