无法复制文件。访问路径被拒绝 [英] Unable to copy file. Access to path denied

查看:169
本文介绍了无法复制文件。访问路径被拒绝的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


我刚刚在运行Win10(x64)的笔记本电脑上下载了Visual Studio 2015。我去创建我的第一个控制台应用程序并成功打开。我继续编写一个简单的应用程序..

   namespace   ConsoleApplication1   
{
程序
{
静态 无效 主要 string [] args
{
控制台 WriteLine " Hello World" );
控制台 ReadLine ();
}
}
}



当我点击调试时,我收到错误说...


无法复制文件"obj\Debug \ConsoleApplication1.exe"到"bin \Debug \ConsoleApplication1.exe"。访问路径'obj\Debug\ConsoleApplication1.exe'被拒绝。




然而,当我注释掉  Console.ReadLine() 代码,
应用程序运行得很好。我无法想象没有这些的编写应用程序  Console.ReadLine() 语句
因为它允许最终用户添加信息。当代码运行时没有这行,它是当然,运行,完成和停止。



任何人都可以告诉我为什么这不会运行?我后来尝试评论出Console.WriteLine(),它也有效。由于某些原因,这两行代码不能很好地协同工作。

解决方案

根据您的帖子,您正在使用Visual Studio。此论坛适用于团队服务(VSTS),我正在将此主题移至相应的
论坛以获得更好的帮助。


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? I later tried commenting out the Console.WriteLine() and it worked as well. For some reason these two lines of code will not play well together.

解决方案

According to your post, you're using Visual Studio. This forum is for Team Service(VSTS), I am moving this thread to the appropriate forum for better assistance.


这篇关于无法复制文件。访问路径被拒绝的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆