我使用的是Visual Studio 2005。在先从版本控制中获取代码后, c#.net应用程序正常运行。但是,在做了一些修改后,当我建立我得到以下错误:

错误383无法复制文件“..\root\leaf\Bin\Debug\test.Resources.xml”到 “本\调试\ test.Resources.xml”。访问路径“Bin\Debug\test.Resources.xml”是 否认。li.rollmodel

有人知道为什么会出现这个问题吗?

编辑我可以看到我的整个项目源代码文件夹是只读的,我无法删除只读属性。

首先,有人能告诉我如何删除这个文件夹的只读属性吗?我尝试删除它,但只读属性仍然存在。我也从版本控制方面尝试过,但也没有成功。


当前回答

我也有同样的问题,为了解决这个问题,我检查了/做了几件事

什么不起作用

1) Read/write permissions were given to directory 
2) Restarted visual studio
3) Tried deleting visual studio temp files

最后什么起作用了

只需将Fred Morrison给出的命令粘贴到“包管理器控制台”:

Get-Process | Where-Object -Property Name -EQ 'VBCSCompiler' | Stop-Process -Force -Verbose

注意:只是观察重新启动Visual studio可能不会在这种情况下工作,但重新启动系统可以,因为停止进程“VBCSCompiler”是解决方案,所以我们可以这样做。

其他回答

我使用Visual Studio 2013。我曾两次遇到这个问题:

On first occasion, I was running Visual Studio without Administrator rights. So, I closed VS and started it using 'Run as administrator' option. This solved my problem. On second occasion, I restarted VS many times, every time making sure that I am running it as an administrator. Also, I rebuilt solution many times. But, in spite of that I was getting error. After that, I removed the concerned file from the target location (the file was already present may be from the previous build at the location where it tries to copy to) and rebuilt the solution. After that, error went away and everything ran smoothly!

遇到同样的问题,但是每次重新启动Visual Studio对我来说都是没有选择的,因为这个问题有时会经常发生。

我通过安装Unlocker来处理它(试图在安装时安装任何工具栏,所以不要忘记取消选中这个),这个应用程序让我快速访问重命名/删除锁定的“.xml”-文件。我知道这也只是一个变通办法,但对我来说,这是解决这个问题最快的办法。

在我的例子中,我将一个项目从Windows移植到OSX,使用Visual Studio Community 7.1.5 for Mac。在项目首选项上禁用使用MSBuild引擎(推荐用于这种类型的项目)选项:

老帖子,但是这个僵尸正在VS 2017(我还没有深入研究为什么它只是“一些”项目)。在这种情况下,它不是用户权限,而是IIS Express进程仍在使用文件。

您将在任务托盘中看到图标

右击 退出 您应该能够在没有这个恼人的“拒绝许可”消息的情况下重新构建。

这也是为什么“重新启动Visual Studio”将“修复”这个问题。这样做将停止IIS Express。

Hth……

我知道这是一个老帖子,但对于那些寻找答案的人,就像我几分钟前一样,我建议先试着重启你的电脑。光是这一点就解决了我的问题。以前甚至不能手动复制到文件夹。