Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ASP.NET 5 Process.Start?

I am trying to use Process.Start in an ASP.NET Beta8 project that I would like to be able to run on Linux using .Net core. Visual studio is giving me an error at compile time:

Error CS0103 The name 'Process' does not exist in the current context

Going back and hovering my mouse over Process.Start I can see a message that says "DNX core 5.0 not available". Is there a different way of invoking processes in asp.net 5? Or perhaps this isn't possible yet?

Here is exactly how I am using it:

var p = Process.Start("someprog", "someargs");
p.WaitForExit();
like image 706
George Richardson Avatar asked Feb 08 '23 13:02

George Richardson


1 Answers

So it was me not really not knowing how the new project system works for .net. I needed to add a dependency to my project.json:

"frameworks": {
    "dnx451": { },
    "dnxcore50": {
      "dependencies": {
        "System.Diagnostics.Process": "4.1.0-beta-23409"
      }
    }
  },

Adding this made it compile. Although I am not sure if that version number is correct.

like image 112
George Richardson Avatar answered Feb 15 '23 10:02

George Richardson