TFS - 自動建置到Azure時,發生Nuget版本不合的錯誤

15 July 2013 — Written by Sky Chang
#Azure#NuGet#TFS

之前因為Team Foundation Service上面沒有最新的Azure SDK,所以就把CI的功能關掉,而今天心血來潮,把它重新啟動的時候,就發生了如下的錯誤,建置失敗…

image

錯誤訊息如下,還滿長的,但主要是在敘說,我現在的NuGet版本是1.8,已經太舊了。

Debug | Any CPU 4 個錯誤,0 個警告 $/Study4/Main/Source/Study4/Study4.sln ('Other\Study4Azure:Publish' 個目標) - 4 個錯誤,0 個警告,檢視記錄檔 C:\a\src\Study4\Main\Source\Study4.nuget\nuget.targets (58): The schema version of 'Microsoft.Bcl' is incompatible with version 1.8.30604.0 of NuGet. Please upgrade NuGet to the latest version from http://go.microsoft.com/fwlink/?LinkId=213942. C:\a\src\Study4\Main\Source\Study4.nuget\nuget.targets (58): The schema version of 'Microsoft.Bcl.Build' is incompatible with version 1.8.30604.0 of NuGet. Please upgrade NuGet to the latest version from http://go.microsoft.com/fwlink/?LinkId=213942. C:\a\src\Study4\Main\Source\Study4.nuget\nuget.targets (58): One or more errors occurred. C:\a\src\Study4\Main\Source\Study4.nuget\nuget.targets (58): The command ""C:\a\src\Study4\Main\Source\Study4.nuget\nuget.exe" install "C:\a\src\Study4\Main\Source\Study4\Webs\Study4.Web\packages.config" -source "" -o "C:\a\src\Study4\Main\Source\Study4\packages"" exited with code 1. $/Study4/Main/Source/Study4/Study4.sln 已編譯 $/Study4/Main/Source/Study4/Study4.sln ('Other\Study4Azure:Publish' 個目標) - 4 個錯誤,0 個警告,檢視記錄檔 沒有測試結果 沒有程式碼涵蓋範圍結果 其他錯誤和警告 1 個錯誤,0 個警告 Exception Message: MSBuild error 1 has ended this build. You can find more specific information about the cause of this error in above messages. (type BuildProcessTerminateException) Exception Stack Trace:    at System.Activities.Statements.Throw.Execute(CodeActivityContext context)    at System.Activities.CodeActivity.InternalExecute(ActivityInstance instance, ActivityExecutor executor, BookmarkManager bookmarkManager)    at System.Activities.Runtime.ActivityExecutor.ExecuteActivityWorkItem.ExecuteBody(ActivityExecutor executor, BookmarkManager bookmarkManager, Location resultLocation)

當下的第一個想法是想說,嗯,那應該又是Team Foundation Service提供的NuGet版本問題,但後來仔細想想,不對阿,Team Foundation Service理論上不太可能提供1.8這種古老版本,後來想到專案裡面重新建置會有一個Nuget.exe檔案,所以打開了檔案仔細看了一下,結果發現,原來是這個exe檔的版本太舊…Orz…

image

既然知道問題所在,那要處理就簡單多了,我們只要重新啟動套件還原功能就可以了;首先,我們先把.nuget整個目錄刪除掉。

image

然後重新再方案的地方啟用NuGet套件還原。

image

重新看一下版本,發現,現在已經到2.6了!!

image

然後再重新啟用CI,終於成功了QQ…第一次遇到這種問題啊…

image

Sky & Study4.TW