简体   繁体   English

ASP.NET 5 Process.Start?

[英]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. 我试图在ASP.NET Beta8项目中使用Process.Start ,我希望能够使用.Net核心在Linux上运行。 Visual studio is giving me an error at compile time: Visual Studio在编译时给出了一个错误:

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". 回过头来将鼠标悬停在Process.Start我可以看到一条消息“DNX core 5.0 not available”。 Is there a different way of invoking processes in asp.net 5? 在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. 所以我真的不知道新项目系统如何适用于.net。 I needed to add a dependency to my project.json: 我需要为我的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. 虽然我不确定该版本号是否正确。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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