JackBarn JackBarn - 2 months ago 14
C# Question

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

I'm trying to use the

Process
class but it gives me this compiler error every time I do


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


I've already added
using System.Diagnostics;
at the top of my code but I still get this error. Autocomplete wont even recognize the class.

Hear is the code. I've only included the
Main method
because the rest of the code has nothing to do with the error.

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
}
}


My IDE is Xamarin Studio if it matters.

Answer

After web searching and attempts, I found the problem.

To fix this, I manually add a reference to System in my project options instead of just typing using System;. I also need to keep using System.Diagnostics; at the top. It's all in the picture below

enter image description here

Thanks guys for trying to help