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

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

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

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

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


当前回答

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

其他回答

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

什么不起作用

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 2015中,改变输出路径对我来说很有效。这应该有助于-更改构建输出目录

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

查看您通过手动复制解决问题的回复,我会说您正在处理的代码是由其他用户(具有管理员权限)制作的,因此它锁定在您身上。通过执行复制——?粘贴,你做了你自己的拷贝的源代码与所有的访问你需要。唯一需要注意的是,在这种情况下,如果其他开发人员需要处理你的副本,他/她会遇到你之前遇到的相同问题。

我也遇到过这个问题。

首先,检查你是否已经将bin和obj文件夹映射到源代码控制程序。

这可能会把你的文件从二进制文件夹变成只读档案,这使得visual studio在编译代码时不可能覆盖它们。

从这些文件夹中删除映射,检查更改后再试一次。

我的问题发生在使用TFS(团队基础服务器)和Visual Studio 2010。

希望这能帮助到一些人。

简单的解决方案:

只需升级以下包

Microsoft.CodeDom.Providers.DotNetCompilerPlatform v1.0.5 to v1.0.7

这将解决问题。