我的團隊有一個很大的解決方案(〜500 csproj's)。我們使用VS2012,並使用TFS Build構建,該構建使用MSBuild 4.目前我們連續構建,但我們想要並行構建(使用msbuild /maxcpucount:4
)。然而,當我試試我的4個處理器的機器上,我得到一個奇怪的故障:MSBuild/m:4失敗,因爲它構建了兩次相同的項目
11:2>CSC : fatal error CS0042: Unexpected error creating debug information file 'C:\Common\obj\Debug\Common.PDB' -- 'C:\Common\obj\Debug\Common.pdb: The process cannot access the file because it is being used by another process. [C:\Common\Common.csproj]
查看日誌,2個MSBuild的節點試圖建立同樣的csproj,從而碰撞上寫一些輸出:
10>Project "C:\Utils\Utils.csproj" (10) is building "C:\Common\Common.csproj" (11) on node 4 (default targets).
46:2>Project "C:\Objects\Objects.csproj" (46:2) is building "C:\Common\Common.csproj" (11:2) on node 1 (default targets).
爲什麼會MSBuild的嘗試構建同一個項目兩次?