【发布时间】:2014-03-19 13:42:12
【问题描述】:
我的构建服务器(TFS/Visual Studio Online)出现以下错误:
CA0055 : Could not load C:\a\Binaries\Api.dll. The following error was encountered while reading module 'System.Net.Http.Formatting': Assembly reference cannot be resolved: Newtonsoft.Json, Version=4.5.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed.
CA0058 : The referenced assembly 'Newtonsoft.Json, Version=4.5.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed' could not be found. This assembly is required for analysis and was referenced by: C:\a\Binaries\Api.dll, C:\a\Sources\MyLocation\packages\Microsoft.AspNet.WebApi.Client.5.1.1\lib\net45\System.Net.Http.Formatting.dll.
这是我的 Api.dll 项目中此程序集的 web.config dependentAssembly 条目:
<dependentAssembly>
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" />
</dependentAssembly>
安装的Json.NET NuGet包的实际版本是6.0.1:
在查看项目引用时,我将 Newtonsoft.Json 设为 6.0.0.0:
引用中System.Net.Http.Formatting的版本是5.1.0.0。
在构建定义中启用了 NuGet 恢复,我的本地副本上没有这些错误,仅在 TFS 中。
有人能找出问题所在吗?
我认为这可能是由于 dependentAssembly 条目,但我无法让它工作。
【问题讨论】:
-
要诊断绑定错误,请使用 Fusion Viewer:msdn.microsoft.com/en-us/library/e74a18c4(v=vs.110).aspx。
标签: c# .net tfs web-config nuget