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

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

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

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

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


当前回答

在我的案例中,avast反病毒隔离了需要从avast应用程序复制的[app-name].exe文件,我不得不去保护>隔离,点击文件旁边的菜单按钮,然后点击“恢复并添加例外”,如下所示

其他回答

我使用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!

我通过删除bin文件夹中的有争议的文件并重新构建项目来解决这个问题。

只需确保该文件夹不是只读的,然后重新构建解决方案

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

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

这在Visual Studio 2017中再次出现,在这种情况下,原因是应用程序洞察过程ServiceHub.DataWarehouseHost.exe。

线程警告MSB3026中讨论了一个解决方案:无法复制“obj\Debug\netcoreapp1.1\src. exe”。“bin\Debug\netcoreapp1.1\src. pdb”到“bin\Debug\netcoreapp1.1\src. pdb”Pdb”,即在项目中添加一个预构建事件,以便在每次构建项目时终止进程。引用这个链接:

右键单击项目上的属性 选择属性 构建事件 预构建事件命令行

taskkill /IM ServiceHub.DataWarehouseHost.exe /F 2>nul 1>nul
Exit 0

保存并构建