在CI环境中MSBuild"无法复制文件"

Tri*_*ion 2 msbuild hudson

我正在使用Hudson作为持续集成服务器.这些工作最终将启动MSBuild.每个人偶尔,我的构建失败,出现MSBuild的非代码编译错误:

C:\WINDOWS\Microsoft.NET\Framework\v3.5\Microsoft.Common.targets(2703,9): error MSB3021: Unable to copy file "..\Lib\Microsoft\Microsoft.Practices.Unity.Configuration.dll" to "bin\Debug\Microsoft.Practices.Unity.Configuration.dll". Access to the path 'bin\Debug\Microsoft.Practices.Unity.Configuration.dll' is denied.
Run Code Online (Sandbox Code Playgroud)

当我检查'bin\Debug\Microsoft.Practices.Unity.Configuration.dll'时,我发现它是一个0字节的文件.

我不知道为什么这个文件有问题.有任何想法吗?

Nic*_*nov 6

MS Build Copy任务具有无证功能,至少谷歌保持沉默.如果设置系统范围的环境变量MSBUILDALWAYSRETRY = 1此任务将重试复制文件,即使它在复制操作期间获得Access Denied异常

输出示例

C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets (3513): Got System.UnauthorizedAccessException: Access to the path 'C:\Builds\8\28\Binaries\Release\fr\System.Spatial.resources.dll' is denied.
   at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
   at System.IO.File.InternalCopy(String sourceFileName, String destFileName, Boolean overwrite, Boolean checkHost)
   at System.IO.File.Copy(String sourceFileName, String destFileName, Boolean overwrite)
   at Microsoft.Build.Tasks.Copy.CopyFileWithLogging(FileState sourceFileState, FileState destinationFileState)
   at Microsoft.Build.Tasks.Copy.DoCopyWithRetries(FileState sourceFileState, FileState destinationFileState, CopyFileWithState copyFile) copying C:\Builds\8\28\Sources\Main\Solutions\packages\System.Spatial.5.2.0\lib
et40\fr\System.Spatial.resources.dll to C:\Builds\8\28\Binaries\Release\fr\System.Spatial.resources.dll and HR is -2147024891
 C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets (3513): Retrying on ERROR_ACCESS_DENIED because MSBUILDALWAYSRETRY = 1
 C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets (3513): Could not copy "C:\Builds\8\28\Sources\Main\Solutions\packages\System.Spatial.5.2.0\lib
et40\fr\System.Spatial.resources.dll" to "C:\Builds\8\28\Binaries\Release\fr\System.Spatial.resources.dll". Beginning retry 1 in 1000ms. Access to the path 'C:\Builds\8\28\Binaries\Release\fr\System.Spatial.resources.dll' is denied.
Run Code Online (Sandbox Code Playgroud)