2015-05-19 190 views
0

我有一個非常小,簡單的ASP.NET MVC應用程序(MVC 4我認爲.net Framework 4)它由一個控制器和一個操作服務一個頁面組成。AppHarbor構建不會失敗,缺少dll

我在AppHarbor上部署它,在本地機器上用git推送它,我從來沒有在本地運行它的問題,它從來沒有在AppHarbour上構建問題/錯誤,但現在每隔一段時間新建立(在我的腦海裏沒有相關更改)將開始拋出以下錯誤:

Could not load file or assembly 'Microsoft.Threading.Tasks, Version=1.0.12.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.

展望本頂端回答here整理它,我刪除所列出的相關組件,並再次合作。但隨後又回來了。嘗試了很多不同的建議,它總是使用nuget,嘗試刪除所有內容並重新安裝,當我甚至不知道我改變了什麼,現在它不再工作時,它又開始工作。今天我將它切換到NuGet Package Restore,如here所示,但這沒有任何區別。

我可以重新部署最後一個工作構建,我注意到比較從AppHarbor下載的工作/不工作構建是Web/App.configs完全相同(不依賴程序集entriy),而是Microsoft.Threading。任務dlls和xmls(包括Extensions和Extensions.Desktop)不在破損的版本中(在工作版本中,它們出現在根目錄和bin中)?

在該項目中,dll從應用程序的packages文件夾鏈接,並且Copy Local爲True,但它們不是Web應用程序的直接依賴項,而是其使用的Google Calendar API的直接依賴項。

更新 在寫我在構建日誌更仔細地看了看,發現工作和不工作的構建之間的顯着差異的答案的後面。

Microsoft.Threading.Tasks.dll不是Google.Apis.Gmail.v1.dll所需的直接依賴項,在構建日誌將包含的工作構建中(請參閱底線複製Microsoft.Threading。 Tasks.dll):

\Google.Apis.Gmail.v1.dll". Copying file from "D:\temp\voz3srsa.vhb\input\TwitterBot\packages\Google.Apis.1.9.0\lib\net40\Google.Apis.PlatformServices.dll" to "D:\temp\voz3srsa.vhb\output\Google.Apis.PlatformServices.dll". Copying file from "D:\temp\voz3srsa.vhb\input\TwitterBot\packages\TweetSharp.2.3.1\lib\4.0\Hammock.ClientProfile.dll" to "D:\temp\voz3srsa.vhb\output\Hammock.ClientProfile.dll". Copying file from "D:\temp\voz3srsa.vhb\input\TwitterBot\packages\log4net.2.0.3\lib\net40-full\log4net.dll" to "D:\temp\voz3srsa.vhb\output\log4net.dll". Copying file from "D:\temp\voz3srsa.vhb\input\TwitterBot\packages\Microsoft.Bcl.Async.1.0.168\lib\net40\Microsoft.Threading.Tasks.dll" to "D:\temp\voz3srsa.vhb\output\Microsoft.Threading.Tasks.dll".

的未工作版本將在其處不同的DLL(再參照底線,Microsoft.Web.Infrastructure.dll):

\Google.Apis.Gmail.v1.dll". Copying file from "D:\temp\0kzqakoc.4jo\input\TwitterBot\packages\Google.Apis.1.9.0\lib\net40\Google.Apis.PlatformServices.dll" to "D:\temp\0kzqakoc.4jo\output\Google.Apis.PlatformServices.dll". Copying file from "D:\temp\0kzqakoc.4jo\input\TwitterBot\packages\TweetSharp.2.3.1\lib\4.0\Hammock.ClientProfile.dll" to "D:\temp\0kzqakoc.4jo\output\Hammock.ClientProfile.dll". Copying file from "D:\temp\0kzqakoc.4jo\input\TwitterBot\packages\log4net.2.0.3\lib\net40-full\log4net.dll" to "D:\temp\0kzqakoc.4jo\output\log4net.dll". Copying file from "D:\temp\0kzqakoc.4jo\input\TwitterBot\packages\Microsoft.Web.Infrastructure.1.0.0.0\lib\net40\Microsoft.Web.Infrastructure.dll" to "D:\temp\0kzqakoc.4jo\output\Microsoft.Web.Infrastructure.dll".

展望在構建中缺少dll我發現this answer但我嘗試了一個命令提示符在本地構建並且工作正常。

更新2 此外,在試圖解決這個我已經注意到在構建(不是警告)周圍參考版本註釋:

1> Consider app.config remapping of assembly "Newtonsoft.Json, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed" from Version "4.5.0.0" [C:\Users...\packages\TweetSharp.2.3.1\lib\4.0\Newtonsoft.Json.dll] to Version "6.0.0.0" [C:\Users...\packages\Newtonsoft.Json.6.0.6\lib\net40\Newtonsoft.Json.dll] to solve conflict and get rid of warning. 1>C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(1605,5): warning MSB3247: Found conflicts between different versions of the same dependent assembly.

無法拿到排序,但做了重新映射得到this其中添加app.config(這對web應用程序沒有意義)重定向修復了它在web.config中的重定向沒有的地方。這確實阻止了構建問題,但沒有多大意義。

回答

0

我把它帶到了AppHarbor支持論壇,因爲這裏沒有得到任何迴應,Build succeeding but missing dll他們是非常有用的,它現在看起來像它已解決。

儘管在Visual Studio 2012 Professional中,所有引用都標記爲Copy Local True,但它們沒有True標籤,因此我手動爲這三個庫添加了這些標籤。就是這樣,DLL被複制。

有很多關於這種差異的鏈接,MSBuild需要它們(儘管我已經嘗試過使用MSBuild構建並且很好),Visual Studio默認不會插入它們(如果切換設置爲false,可能會出現false然後是true),它表現爲不復制引用引用。

Stack Overflow question, see highest voted answer not accepted hack

Raised with Microsoft and closed as not reproducible