简体   繁体   English

无法复制文件。 拒绝访问路径

[英]Unable to copy file. Access to path denied

I just did a fresh download of Visual Studio 2015 on my laptop running Win10 (x64). 我刚刚在运行Win10(x64)的笔记本电脑上重新下载了Visual Studio 2015。 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". 无法将文件“ obj \\ Debug \\ ConsoleApplication1.exe”复制到“ bin \\ Debug \\ ConsoleApplication1.exe”。 Access to the path 'obj\\Debug\\ConsoleApplication1.exe' is denied. 拒绝访问路径“ obj \\ Debug \\ ConsoleApplication1.exe”。

However, when I comment out the Console.ReadLine() code, the application runs just fine. 但是,当我注释掉Console.ReadLine()代码时,该应用程序运行正常。 I can't imagine writing an application without these Console.ReadLine() statements because it allows for the end user to add information. 我无法想象没有这些Console.ReadLine()语句就可以编写应用程序,因为它允许最终用户添加信息。 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() ? 谁能告诉我为什么它不能与Console.ReadLine()一起运行? It also didn't run with Console.ReadKey() either. 它也没有与Console.ReadKey()一起运行。

杀死VBCSCompiler.exe进程帮助我

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

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