2015-05-19 115 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