2014-01-23 36 views
3

我在VS2012更新3使用TFS2012。建築工地通過devenv.exe工作,msbuild失敗

我使用devenv和msbuild構建相同的解決方案。當我到達網站項目時,devenv不會報告任何錯誤,但msbuild會重複執行。日誌兩個樣本:

devenv的:

114>------ Build started: Project: C:\...\API\, Configuration: Debug Any CPU ------ 
114>Could not get dependencies for project reference 'A'Could not get dependencies for  project reference 'BusinessLogic' Could not get dependencies for project reference 'BusinessLogic.ASPAgents' Could not get dependencies for project reference 'DataAccessLogicComponents' Could not get dependencies for project reference 'UI'Validating Web Site 
114>Building directory '/API/'. 
114> 
114>Validation Complete 

的MSBuild:

121>C:\Scrubbed\API.metaproj : warning MSB3274: The primary reference "C:\Scrubbed\PreMVC\A\bin\Release\A.dll" could not be resolved because it was built against the ".NETFramework,Version=v4.5" framework. This is a higher version than the currently targeted framework ".NETFramework,Version=v4.0". 
121>C:\Scrubbed\API.metaproj : warning MSB3274: The primary reference "C:\Scrubbed\PreMVC\BusinessLogic\bin\Release\A.Web.BusinessLogic.dll" could not be resolved because it was built against the ".NETFramework,Version=v4.5" framework. This is a higher version than the currently targeted framework ".NETFramework,Version=v4.0". 
121>C:\Scrubbed\API.metaproj : warning MSB3275: The primary reference "C:\Scrubbed\PreMVC\BusinessLogic\bin\Release\A.Web.BusinessLogic.dll" could not be resolved because it has an indirect dependency on the assembly "A, Version=0.0.0.15, Culture=neutral, PublicKeyToken=060d385c0c45e767" which was built against the ".NETFramework,Version=v4.5" framework. This is a higher version than the currently targeted framework ".NETFramework,Version=v4.0". 

    C:\Windows\Microsoft.NET\Framework\v4.0.30319\aspnet_compiler.exe -v /API -p PreMVC\API\ -u -f PrecompiledWeb\API\ 

121>C:\Scrubbed\PreMVC\API\App_Code\File1.cs(7): error CS0234: The type or namespace name 'BusinessLogic' does not exist in the namespace 'A.Web' (are you missing an assembly reference?) [C:\Scrubbed\API.metaproj] 
121>C:\Scrubbed\PreMVC\API\App_Code\File1.cs(8): error CS0234: The type or namespace name 'UI' does not exist in the namespace 'A.Web' (are you missing an assembly reference?) [C:\Scrubbed\API.metaproj] 
121>C:\Scrubbed\PreMVC\API\App_Code\File1.cs(12): error CS0234: The type or namespace name 'UI' does not exist in the namespace 'A.Web' (are you missing an assembly reference?) [C:\Scrubbed\API.metaproj] 
121>C:\Scrubbed\PreMVC\API\App_Code\File2.cs(7): error CS0234: The type or namespace name 'BusinessLogic' does not exist in the namespace 'A.Web' (are you missing an assembly reference?) [C:\Scrubbed\API.metaproj] 
121>C:\Scrubbed\PreMVC\API\App_Code\File2.cs(8): error CS0234: The type or namespace name 'UI' does not exist in the namespace 'A.Web' (are you missing an assembly reference?) [C:\Scrubbed\API.metaproj] 
121>C:\Scrubbed\PreMVC\API\App_Code\File2.cs(12): error CS0234: The type or namespace name 'UI' does not exist in the namespace 'A.Web' (are you missing an assembly reference?) [C:\Scrubbed\API.metaproj] 
121>C:\Scrubbed\PreMVC\API\App_Code\File3.cs(7): error CS0234: The type or namespace name 'BusinessLogic' does not exist in the namespace 'A.Web' (are you missing an assembly reference?) [C:\Scrubbed\API.metaproj] 
121>C:\Scrubbed\PreMVC\API\App_Code\File3.cs(8): error CS0234: The type or namespace name 'UI' does not exist in the namespace 'A.Web' (are you missing an assembly reference?) [C:\Scrubbed\API.metaproj] 
121>Done Building Project "C:\Scrubbed\API.metaproj" (Rebuild target(s)) -- FAILED. 

任何想法,爲什麼devenv的進行,但MSBuild的立即失敗?

+0

從命令提示符運行devenv可能與使用msbuild有所不同,因爲它可能會引入一些不適用於msbuild的用戶/ UI設置。只是一個隨機的想法。 –

回答

2

我從MSDN論壇的MOD獲得了答案。基本上MSBuild對依賴關係非常嚴格,devenv只是提出警告,但繼續進行。

我們最終完全轉向.NET 4.5,所以我們修復了不匹配,最終將我們的構建移到了MSBuild。

0

確保您將項目引用添加到其他項目,並且它們都使用相同版本的.NET框架。

+0

我在問爲什麼一個似乎工作,一個似乎失敗。無論如何我都將項目更新到了.NET 4.5,並且自從devenv隨機(有時 - 比如15個版本中的1個)轉換爲MSBuild的「任務被取消」問題。 – jmcdade

0

日誌中的警告是不是告訴故事?

「121> C:\ Scrubbed \ API.metaproj:警告MSB3274:主要引用」C:\ Scrubbed \ PreMVC \ A \ bin \ Release \ A.dll「無法解析,因爲它是針對「.NETFramework,Version = v4.5」框架,這是一個比當前目標框架「.NETFramework,Version = v4.0」更高的版本。「

+1

問題(我認爲)是爲什​​麼它對一個而不是另一個起作用。 –