2009-07-15 32 views
2

我使用Hudson作为持续集成服务器。这些工作最终启动了MSBuild。在一段时间大家一次,我的生成失败与非代码编译错误出的MSBuild:MSBuild在CI环境中“无法复制文件”

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. 

当我审视“本\调试\ Microsoft.Practices.Unity.Configuration.dll”,我觉得这成为一个0字节的文件。

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

回答

1

听起来像一个进程是保存bin \ Debug \ Microsoft.Practices.Unity.Configuration.dll打开。 您可以通过将'bin'重命名为其他内容(比如'bin-old')然后删除'bin-old'来检查。如果任何进程将'bin'中的文件保持为打开状态,则重命名将失败。

+0

例如在拒绝访问异常,这是很酷,但怎么办我们阻止vs2012锁定文件?它确实被devenv.exe进程劫持为人质,直到vs2012重新启动才能继续。 – Kirka121 2014-01-23 16:21:09

+1

不知道如何帮助在这方面。我的解决方案旨在帮助您找到更快的故障机制,因此在等待几乎整个构建完成后,您不会发现失败。 – 2014-01-25 02:53:57

0

使用来自SysInternals(Microsoft)的Handle.exe来查看哪些文件被哪些进程保持打开状态。

当出现错误时,在cmd提示符下运行此操作; Handle.exe> OpenFile.txt Notepad.exe OpenFile.txt

然后搜索OpenFile.txt以查看被锁定的文件,您将看到该过程。

瑞安

+0

使用SysInternals中的ProcessExplorer将是更直接的方式。选择“查找”..“查找句柄或DLL ..”,然后将文件名粘贴到搜索框中。 – 2009-07-16 16:50:23

6

MS构建复制任务无证功能,至少谷歌保持沉默。 如果设定全系统的环境变量MSBUILDALWAYSRETRY = 1 该任务将重新尝试复制一个文件,即使它被拷贝操作输出

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.