CI builds frequently fail with MSB3021: Access to the path xxx.dll is denied #9190
-
A couple of weeks ago, our continuous integration builds started failing frequently with the above error. We assume it's some change in our build infrastructure (possibly more aggressive AntiVirus?), but we're not making much progress with corporate IT in working out what may have changed and what we can do about it. Is there anything I can do to make the build more tolerant, and retry any failed copy? I tried setting the following in Directory.Build.props, but as far as I can see, it had zero effect. <PropertyGroup>
<!-- Attempt to make the build more reliable when copying dependencies conflict -->
<CopyRetryCount>5</CopyRetryCount>
<CopyRetryDelayMilliseconds>400</CopyRetryDelayMilliseconds>
<SkipUnchangedFiles>true</SkipUnchangedFiles>
</PropertyGroup> Bizarrely, my last failure logged an error and 2 warnings. The warnings appear to when it is attempting be doing the retry. But it looks like Azure.Core.dll failed without any retry.
Notes:
|
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 12 replies
-
Setting the Line 26 in 971bf70 Lines 83 to 88 in 971bf70 |
Beta Was this translation helpful? Give feedback.
-
Hi @RobSwDev @KalleOlaviNiemitalo , Could you please help me in understanding the conclusion on this issue. We are also facing this random issue on our build machine. I have set the set MSBUILDALWAYSRETRY=1 before invoking the msbuild command. But still no luck. We have checked the process monitor and could see no files being used by any process like Anti Virus. TIA |
Beta Was this translation helpful? Give feedback.
Setting the
MSBUILDALWAYSRETRY
environment variable (with any value) would make MSBuild retry the copy after the access-denied error, but I don't know whether those retries would succeed. See also #9169.msbuild/src/Tasks/Copy.cs
Line 26 in 971bf70
msbuild/src/Tasks/Copy.cs
Lines 83 to 88 in 971bf70