.net服务器文件路径拒绝访问,.net c# 无法复制文件.拒绝访问路径

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.

Talk1:

Impossible to say for sure, for anyone not sitting at your computer. But it sure sounds like you haven't exited the previously running instance of your program (i.e. by pressing an appropriate key) before you try to re-compile and run another. Of course, when you remove the call to ReadLine() or ReadKey(), that previously running instance exits normally rather than waiting, so in that case it works fine.

Talk2:

There is a possibility that your anti-virus causes it, in which case you should look for log entries and for quarantined files in the AV. Can also be caused by the disk being close to full. But most likely it's as @PeterDuniho explains.

Talk3:

But this was the very first code I tried to execute. The very first time I tried to compile. There aren't any more programs (that I know of) that are using this file. I also just tried commenting out the Console.WriteLine() line and leaving the ReadLine(). Oddly enough, it works! It just not working with those two together.

Solutions1

killing VBCSCompiler.exe process hepls me

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值