Home > front end >  System cannot find file specified
System cannot find file specified

Time:08-02

So we need to execute a exe in our .net API, and this exe is built at the same time as the API itself in our pipelines.

The exe is present in the exact same directory as our .NET API exe and ddl files.

I used the below code to try and trigger the exe:

 var process = new System.Diagnostics.Process();
                    process.StartInfo.FileName = "customProgram.exe";
                    process.StartInfo.Arguments = Environment.GetEnvironmentVariable("ASPNETCORE_ENVIRONMENT");
                    process.Start();
                    process.WaitForExit();

This throws an error:

 An error occurred trying to start process 'customProgram.exe' with working directory '/app'. No such file or directory

CodePudding user response:

Try to specify the full path to the file. For example like here:

Process.Start(@"C:\Program Files\Google\Chrome\Application\chrome");
  • Related