I just did a fresh download of Visual Studio 2015 on my laptop running Win10 (x64). I go to create my first Console Application and is opens successfully. I proceed to write a simple application..
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Hello World");
Console.ReadLine();
}
}
}
When I clicked debug, I get an error saying...
Unable to copy file "obj\Debug\ConsoleApplication1.exe" to "bin\Debug\ConsoleApplication1.exe". Access to the path 'obj\Debug\ConsoleApplication1.exe' is denied.
However, when I comment out the Console.ReadLine()
code, the application runs just fine. I can't imagine writing an application without these Console.ReadLine()
statements because it allows for the end user to add information. When the code runs without this line, it, of course, runs, completes and stops.
Can anyone tell me why this won't run with Console.ReadLine()
? It also didn't run with Console.ReadKey()
either.