如何阻止 MSBuild 复制任务自动重试 [英] How to stop MSBuild copy tasks from automatically retrying
问题描述
如果输出二进制文件在 Visual Studio 2010(或更早版本)中被锁定,构建就会失败并说它无法复制,因为文件正在使用中.
If output binaries were locked in Visual Studio 2010 (or older), the build would simply fail and say it could not copy because the files were in use.
现在进入重试循环,这真的很烦人,因为:
Now it goes into a retry loop, which is really annoying because:
- 不能被打扰
- 这无济于事
这只是意味着我必须等待更长时间才能构建失败.
It just means I have to wait longer for the build to fail.
有人知道如何关闭吗?
推荐答案
以下几行应该会有所帮助:
The following lines should help:
<PropertyGroup>
<CopyRetryCount>0</CopyRetryCount>
</PropertyGroup>
您应该将它们添加到您的项目文件中(即 *.*proj
,例如 csproj
),紧接在打开
标签.
You should add them into your project file (which is *.*proj
, e.g., csproj
), right after the opening <Project>
tag.
为了全局解决问题,这些行应该放在 c:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets
中 <项目>
标签.更多信息:http://msdn.microsoft.com/en-us/library/3e54c37h.aspx
To solve the problem globally, these lines should be placed in c:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets
right after the opening <Project>
tag.
More info: http://msdn.microsoft.com/en-us/library/3e54c37h.aspx
不确定它是否会在未来导致一些构建问题 - 我现在发现了这一点.
Not sure if it can cause some build problems in future - I found this out right now.
更新:对于 VS 2013 旧位置不再有效,因此您可以将这些行放在 c:\Program Files (x86)\MSBuild\12.0\Microsoft.Common.props
中.
Update:
For VS 2013 old location does not work anymore, so you can place these lines in c:\Program Files (x86)\MSBuild\12.0\Microsoft.Common.props
.
这篇关于如何阻止 MSBuild 复制任务自动重试的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!