使用TFS Build 2010,我已經爲幾個項目構建了運行devenv.com的進程。之後,我希望所有的二進制文件都可以使用C#自定義構建活動與「File.Copy」從輸出文件夾中複製。但是,把我這個異常與文件的第一個副本:TFSBuild 2010:File.Copy c#snippets在編譯後拋出異常
The process cannot access the file 'C:\Test\BuildServer\Sources\Library\LibraryInstall\LibraryInstall\Release\LibraryInstall.msm' because it is being used by another process.
看來該文件仍然被使用由devenv.com。任何想法如何?除了File.Copy,有沒有更好的方法來複制它,無論文件狀態如何?
======
我發現了一個醜陋的方式:
Process proc = new Process();
proc.StartInfo.UseShellExecute = true;
proc.StartInfo.FileName = @"C:\WINDOWS\system32\xcopy.exe";
proc.StartInfo.Arguments = "/Y " + Path.Combine(sourcesDirectory, fileName) + " " + binariesDirectory;
proc.Start();
在的buildin複製任務有一個重試和retrydelay設置。雖然它掩蓋了真正的問題,但它可能是一個醜陋的快速解決方案。 http://msdn.microsoft.com/en-us/library/3e54c37h.aspx – rene
它聽起來像你沒有正確設置依賴和/或運行並行構建。 – leppie
不,它是序列... – lannyboy