這應該解釋一切...就像馬丁說的,你只需要改變你的項目依賴關係,因爲VS非常聰明,可以根據它們來確定構建順序。這就是爲什麼你不能在你的項目依賴關係中有循環引用... VS抱怨,因爲它知道它不能滿足這兩個項目的要求。
![alt text](https://i.stack.imgur.com/gj8bN.png)
UPDATE
項目依賴絕對確定構建順序。你可以發佈你的解決方案和項目的zip嗎?我需要爲自己看這個。:)但是踢,我做了像你概述了一個項目:
這裏是我的項目依賴關係:
項目1 - 主要應用
![alt text](https://i.stack.imgur.com/7QMTE.png)
項目2 - 取決於項目4
![alt text](https://i.stack.imgur.com/484ZD.png)
項目3 - 取決於計劃2
![alt text](https://i.stack.imgur.com/uIBSU.png)
項目4 - 不依賴
![alt text](https://i.stack.imgur.com/GVzu8.png)
我的批量構建屏幕:
![alt text](https://i.stack.imgur.com/Tktda.png)
而且我的輸出窗口 - 注意構建順序。雖然我的項目1實際上被命名爲StackOverflow_BatchBuild,但項目2並未首先構建 - 項目4是。
------ Build started: Project: Project4, Configuration: Debug Any CPU ------
C:\Windows\Microsoft.NET\Framework\v3.5\Csc.exe /noconfig /nowarn:1701,1702 /errorreport:prompt /warn:4 /define:DEBUG;TRACE /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\v3.5\System.Core.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\v3.5\System.Data.DataSetExtensions.dll" /reference:C:\Windows\Microsoft.NET\Framework\v2.0.50727\System.Data.dll /reference:C:\Windows\Microsoft.NET\Framework\v2.0.50727\System.dll /reference:C:\Windows\Microsoft.NET\Framework\v2.0.50727\System.Xml.dll /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\v3.5\System.Xml.Linq.dll" /debug+ /debug:full /filealign:512 /optimize- /out:obj\Debug\Project4.dll /target:library Class1.cs Properties\AssemblyInfo.cs
Compile complete -- 0 errors, 0 warnings
Project4 -> C:\Code\trunk\vs2008\Scratch\StackOverflow_BatchBuild\Project4\bin\Debug\Project4.dll
------ Build started: Project: Project2, Configuration: Debug Any CPU ------
C:\Windows\Microsoft.NET\Framework\v3.5\Csc.exe /noconfig /nowarn:1701,1702 /errorreport:prompt /warn:4 /define:DEBUG;TRACE /reference:C:\Code\trunk\vs2008\Scratch\StackOverflow_BatchBuild\Project4\bin\Debug\Project4.dll /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\v3.5\System.Core.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\v3.5\System.Data.DataSetExtensions.dll" /reference:C:\Windows\Microsoft.NET\Framework\v2.0.50727\System.Data.dll /reference:C:\Windows\Microsoft.NET\Framework\v2.0.50727\System.dll /reference:C:\Windows\Microsoft.NET\Framework\v2.0.50727\System.Xml.dll /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\v3.5\System.Xml.Linq.dll" /debug+ /debug:full /filealign:512 /optimize- /out:obj\Debug\Project2.dll /target:library Class1.cs Properties\AssemblyInfo.cs
Compile complete -- 0 errors, 0 warnings
Project2 -> C:\Code\trunk\vs2008\Scratch\StackOverflow_BatchBuild\Project2\bin\Debug\Project2.dll
------ Build started: Project: Project3, Configuration: Debug Any CPU ------
C:\Windows\Microsoft.NET\Framework\v3.5\Csc.exe /noconfig /nowarn:1701,1702 /errorreport:prompt /warn:4 /define:DEBUG;TRACE /reference:C:\Code\trunk\vs2008\Scratch\StackOverflow_BatchBuild\Project2\bin\Debug\Project2.dll /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\v3.5\System.Core.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\v3.5\System.Data.DataSetExtensions.dll" /reference:C:\Windows\Microsoft.NET\Framework\v2.0.50727\System.Data.dll /reference:C:\Windows\Microsoft.NET\Framework\v2.0.50727\System.dll /reference:C:\Windows\Microsoft.NET\Framework\v2.0.50727\System.Xml.dll /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\v3.5\System.Xml.Linq.dll" /debug+ /debug:full /filealign:512 /optimize- /out:obj\Debug\Project3.dll /target:library Class1.cs Properties\AssemblyInfo.cs
Compile complete -- 0 errors, 0 warnings
Project3 -> C:\Code\trunk\vs2008\Scratch\StackOverflow_BatchBuild\Project3\bin\Debug\Project3.dll
------ Build started: Project: StackOverflow_BatchBuild, Configuration: Debug Any CPU ------
C:\Windows\Microsoft.NET\Framework\v3.5\Csc.exe /noconfig /nowarn:1701,1702 /errorreport:prompt /warn:4 /define:DEBUG;TRACE /reference:C:\Code\trunk\vs2008\Scratch\StackOverflow_BatchBuild\Project3\bin\Debug\Project3.dll /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\v3.5\System.Core.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\v3.5\System.Data.DataSetExtensions.dll" /reference:C:\Windows\Microsoft.NET\Framework\v2.0.50727\System.Data.dll /reference:C:\Windows\Microsoft.NET\Framework\v2.0.50727\System.Deployment.dll /reference:C:\Windows\Microsoft.NET\Framework\v2.0.50727\System.dll /reference:C:\Windows\Microsoft.NET\Framework\v2.0.50727\System.Drawing.dll /reference:C:\Windows\Microsoft.NET\Framework\v2.0.50727\System.Windows.Forms.dll /reference:C:\Windows\Microsoft.NET\Framework\v2.0.50727\System.Xml.dll /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\v3.5\System.Xml.Linq.dll" /debug+ /debug:full /filealign:512 /optimize- /out:obj\Debug\StackOverflow_BatchBuild.exe /resource:obj\Debug\StackOverflow_BatchBuild.Properties.Resources.resources /target:winexe Form1.cs Form1.Designer.cs Program.cs Properties\AssemblyInfo.cs Properties\Resources.Designer.cs Properties\Settings.Designer.cs
Compile complete -- 0 errors, 0 warnings
StackOverflow_BatchBuild -> C:\Code\trunk\vs2008\Scratch\StackOverflow_BatchBuild\bin\Debug\StackOverflow_BatchBuild.exe
========== Build: 4 succeeded or up-to-date, 0 failed, 0 skipped ==========
你怎麼知道它不工作?代碼是否未編譯,或者當您嘗試執行應用程序時是否出現錯誤? – Dave 2010-09-07 04:00:59