"Name 'Process' does not exist in current context" 控制台应用程序出错

"Name 'Process' does not exist in current context" error in console app

我正在尝试使用 Process class 但每次我这样做时它都会给我这个编译器错误

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

我已经在我的代码顶部添加了 using System.Diagnostics;,但我仍然收到此错误。自动完成甚至无法识别 class.

听说是代码。我只包含了 Main method,因为其余代码与错误无关。

using System;
using System.Reflection;
using System.Collections.Generic;
using System.IO;
using System.Diagnostics;
public class MainClass
{
    static void Main()
    {
        AIRuntime adam = new AIRuntime("Adam", false);
        adam.AIUpdate();
        Process.Start(adam.directory);  //adam.directory is just a string
    }
}

我的 IDE 如果重要的话是 Xamarin Studio。

经过网络搜索和尝试,我发现了问题。

为了解决这个问题,我在我的项目选项中手动添加了对 System 的引用,而不仅仅是键入 using System;。我还需要将 using System.Diagnostics; 保持在顶部。都在下图中

感谢大家的帮助