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

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

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

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

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


当前回答

首先转到文件的位置。然后右键单击文件的文件夹->属性->未选中的只读选项,并应用到文件及其子文件夹。 它解决了我的问题。 编码快乐!

其他回答

您不应该将文件夹属性更改为非只读。 你看到这个错误消息的原因是源代码控制假设你只存储了你的杂项文件,而不是bin文件夹,因为它保留了由。net自动创建的文件,它不想把它们添加到源代码控制中。

我建议不要使用Environment。CurrectDirectory(我假设你目前正在使用),你在%appdata% address中创建一个名为“MyProjectName”的文件夹,然后使用:

System.IO.Path.Combine(Environment.GetEnvironmentVariable(“appdata”),“YourProjectName”).

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

我使用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/release文件夹中的文件添加到安装项目的应用程序文件文件夹中时,就产生了这个问题。安装项目的源代码控制一直阻止我完成主应用程序项目的构建。

解决方案:在包含安装中要包含的所有文件的任何项目之外创建一个单独的转储文件夹,并从那里添加它们。这很痛苦,因为现在我必须记住为每个新的安装包复制所有文件。我可能会看看我是否可以做一些构建后的行动,我们的自动构建,使过程更顺利。