简体   繁体   中英

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();

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM