Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to stop MSBuild copy tasks from automatically retrying

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 can't be interrupted
  • It doesn't help the situation

It just means I have to wait longer for the build to fail.

Does anyone know how to turn this off?

like image 566
pm100 Avatar asked Apr 27 '12 16:04

pm100


1 Answers

The following lines should help:

<PropertyGroup>
  <CopyRetryCount>0</CopyRetryCount>
</PropertyGroup>

You should add them into your project file (which is *.*proj, e.g., csproj), right after the opening <Project> tag.

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.

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.

like image 171
Pavel Samarkin Avatar answered Oct 15 '22 11:10

Pavel Samarkin