Run a C # program to run another C # program in mono

I am currently running a server program written in C # and I am trying to add support for this .net software on Linux. Almost everything works as intended under mono, but some things do not work. For example, upon successful completion of the server software, it is assumed that another external program written in C # will instantly appear and send signals from a text file. In a .net environment such as windows 7, this just works with

Process.Start("Heartbeat.exe"); 

What is it. He appears.

Annnnnnnnd, when the server software detects that the host system is mono, I tried to run different code after the server shutdown function. The above code is not valid. I tried to do this, but I probably don’t know what I am doing.

 ProcessStartInfo procInfo = new ProcessStartInfo(); procInfo.UseShellExecute = false; procInfo.FileName = "Heartbeat.exe"; Process.Start(procInfo); 

This does not work either. I tried to run .sh to run .exe as well with mono args, but it was very inefficient. Any help and any help is appreciated. (Before you guys scream to me to read the ProcessStartInfo mono and APIs, like most people, I read them both, and I still don't understand anything. Also, the mono API is weird.)

Edit:

Thanks, Lex Lee for the answer, but when using

 Process.Start("mono Heartbeat.exe") 

I get this error:

 Error when getting information for file '/home/me/Desktop/LCDev/mono Heartbeat.exe': No such file or directory 

I assume the above code is trying to run a program called "mono Heartbeat.exe" instead of opening Heartbeat.exe with mono.

+4
source share
1 answer

C # applications should run on Linux using mono, so you should use

Process.Start("mono", "full_path_of_your_exe");

+9
source

Source: https://habr.com/ru/post/1502222/


All Articles