2015-10-20 205 views
2

嗨,我最近幾天一直在b my我的腦袋。TFS 2015構建問題

這裏是情況...
1.我有VSO帳戶,它維護雲中的TFS。
2.在另一臺機器上安裝構建服務器/代理。 (工作正常)
3.試圖使用該服務器/控制器構建(XAML構建)一個解決方案。
4.收到錯誤消息...

"The imported project "C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.0\WebApplications\Microsoft.WebApplication.targets" was not found. Confirm that the path in the declaration is correct, and that the file exists on disk."

構建服務器和代理是從2015年TFS和項目使用框架4.6的Visual Studio 2015年項目。我在編譯期間期待目標文件的「v14」文件夾。爲什麼它試圖從「v11」文件夾中找到東西?我該如何解決這個問題。

我知道我可以將文件複製到「v11」,但我不想逃避事實。應該有一個原因和適當的修復。你能幫忙的話,我會很高興。

+0

中有什麼的csproj文件ToolsVersion?它是不是'

回答

0

您的Web應用程序中引用了WebApplications \ Microsoft.WebApplication.targets(11.0)(來自VS2012),因此Visual Studio 2012應安裝在構建服務器上以解決此問題。

請注意,要保證TFS構建成功運行,您應該確保您的構建代理機器具有某些開發機器環境。

+1

感謝您的回覆,但我認爲您錯過了這一點。我正在使用visual studio 2015.所有組件均安裝在「v14.0」中,並且沒有預期的文件夾「v11.0」。爲什麼MSbuild覆蓋目標,並強制它成爲「v11.0」!示例proj文件:

0

您是否從以前的TFS版本恢復了以前的TFS 2015集合?您的解決方案或解決方案中的任何項目是否在VS2015之前創建?

2

幾種解決方案,爲您更正此錯誤:

S1:通過運行以下命令安裝從NuGet gallery MSBuild.Microsoft.VisualStudio.Web.targets:安裝,包裝MSBuild.Microsoft.VisualStudio.Web.targets。
然後用

<Import Project="$..\packages\MSBuild.Microsoft.VisualStudio.Web.targets.14.0.0\tools\VSToolsPath\WebApplications" /> 

S2替換下面的行中的.proj文件

<Import Project="$(MSBuildBinPath)\Microsoft.WebApplication.targets" /> 

:設置在構建定義的/p:VisualStudioVersion=12.0的MSBuild參數。
S3:將Microsoft.VisualStudio.Web.targets文件複製到構建代理機器上的C:\ Program Files(x86)\ MSBuild \ Microsoft \ VisualStudio \ v11.0 \ WebApplications文件夾中。
S4:像Patrick先前提到的那樣,在TFS構建代理機器上安裝VS2012。

及相關案件:Microsoft.WebApplication.targetsMicrosoft.WebApplication.targets was not found, on the build server. What's your solution?