c# – 无法加载文件或程序集’System.Net.Http.Formatting-Cosmo’
内容导读
互联网集市收集整理的这篇技术教程文章主要介绍了c# – 无法加载文件或程序集’System.Net.Http.Formatting-Cosmo’,小编现在分享给大家,供广大互联网技能从业者学习和参考。文章包含7339字,纯文字阅读大概需要11分钟。
内容图文
这个错误刚刚开始发生.使用Visual Studio 2017,System.Net.Http.Formatting问题已经持续了好几年.
我只在网页上看到此消息:
Could not load file or assembly ‘System.Net.Http.Formatting-Cosmo’ or one of its dependencies. The located assembly’s manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
跟踪追溯:
=== Pre-bind state information ===
LOG: DisplayName = System.Net.Http.Formatting-Cosmo
(Partial)
WRN: Partial binding information was supplied for an assembly:
WRN: Assembly Name: System.Net.Http.Formatting-Cosmo | Domain ID: 2
WRN: A partial bind occurs when only part of the assembly display name is provided.
WRN: This might result in the binder loading an incorrect assembly.
WRN: It is recommended to provide a fully specified textual identity for the assembly,
WRN: that consists of the simple name, version, culture, and public key token.
WRN: See whitepaper http://go.microsoft.com/fwlink/?LinkId=109270 for more information and common solutions to this issue.
LOG: Appbase = file:///C:/Users/George/OneDrive/SignupList/SignupList/
LOG: Initial PrivatePath = C:\Users\George\OneDrive\SignupList\SignupList\bin
Calling assembly : (Unknown).
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: C:\Users\George\OneDrive\SignupList\SignupList\web.config
LOG: Using host configuration file: C:\Users\George\OneDrive\IISExpress\config\aspnet.config
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\v4.0.30319\config\machine.config.
LOG: Policy not being applied to reference at this time (private, custom, partial, or location-based assembly bind).
LOG: Attempting download of new URL file:///C:/Users/George/AppData/Local/Temp/Temporary ASP.NET Files/vs/6cc2628d/51b3c1a6/System.Net.Http.Formatting-Cosmo.DLL.
LOG: Attempting download of new URL file:///C:/Users/George/AppData/Local/Temp/Temporary ASP.NET Files/vs/6cc2628d/51b3c1a6/System.Net.Http.Formatting-Cosmo/System.Net.Http.Formatting-Cosmo.DLL.
LOG: Attempting download of new URL file:///C:/Users/George/OneDrive/SignupList/SignupList/bin/System.Net.Http.Formatting-Cosmo.DLL.
WRN: Comparing the assembly name resulted in the mismatch: NAME
ERR: Failed to complete setup of assembly (hr = 0x80131040). Probing terminated.
似乎停止尝试在配置中找到具有正确DLL版本的System.Net.Http.Formatting.
<dependentAssembly>
<assemblyIdentity name="System.Net.Http.Formatting" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-5.2.3.0" newVersion="5.2.3.0" />
</dependentAssembly>
我使用ASP.NET而不是MVC,我不知道为什么需要System.Net.Http.Formatting. Cosmo是我的电脑名称.我希望-Cosmo不是问题,我不明白为什么会这样.
我在Stack Overflow – Could not load file or assembly ‘System.Net.Http.Formatting’ or one of its dependencies. The system cannot find the path specified的前4年帖子中做了所有提到的事情
没有解决它.我找到了其他帖子并使用了Microsoft.AspNet.WebApi.Core V 5.2.4,它将System.Net.Http.Formatting V 5.2.3.0.
System.Net.Http.Formatting Reference上的Local Copy属性设置为True.她重新获得的所有包裹.该项目已重新初始化.我已经尝试了所有可以找到的建议.
没有Microsoft.AspNet.WebApi.Core,如果我编译我得到编译错误抱怨System.Net.Http.Formatting缺失.添加Core返回,错误消失,编译正常.由于依赖性,我还必须删除并重新添加Microsoft.AspNet.WebApi.WebHost和Microsoft.AspNet.WebApi.Core.运行它时的网页会给出错误以及项目中每个ASPX文件的顶行.
我也有Newtonsoft.Json,我见过这与此有关.
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="WebGrease" culture="neutral" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="0.0.0.0-1.6.5135.21930" newVersion="1.6.5135.21930" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="EntityFramework" publicKeyToken="b77a5c561934e089" />
<bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Owin" culture="neutral" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="0.0.0.0-3.0.1.0" newVersion="3.0.1.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Owin.Security.OAuth" culture="neutral" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="0.0.0.0-3.0.1.0" newVersion="3.0.1.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Owin.Security.Cookies" culture="neutral" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="0.0.0.0-3.0.1.0" newVersion="3.0.1.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Owin.Security" culture="neutral" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="0.0.0.0-3.0.1.0" newVersion="3.0.1.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Web.Http" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-5.2.3.0" newVersion="5.2.3.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Telerik.Web.UI" publicKeyToken="121fae78165ba3d4" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2014.3.1209.45" newVersion="2014.3.1209.45" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Antlr3.Runtime" publicKeyToken="eb42632606e9261f" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-3.5.0.2" newVersion="3.5.0.2" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-8.0.0.0" newVersion="8.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Google.Apis" publicKeyToken="4b01fa6e34db77ab" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-1.25.0.0" newVersion="1.25.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Google.Apis.Core" publicKeyToken="4b01fa6e34db77ab" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-1.25.0.0" newVersion="1.25.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Net.Http.Formatting" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-5.2.3.0" newVersion="5.2.3.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
程序集正在寻找System.Net.Http.Formatting-Cosmo并尝试下载它. System.Net.Http.Formatting正在bin中,我甚至添加了System.Net.Http.Formatting-Cosmo以防万一.版本匹配.为什么找不到bin DLL? -Cosmo有问题吗?
令人费解.
乔治
解决方法:
它现在已修复,但我不确定它是如何修复的,因为我尝试了很多不同的东西,包括更新Visual Studio和摆脱旧的Visual Studios,它没有解决问题,但确实改变了一点.
我注意到System.Net.Http.Formatting.dll的版本为5.2.60201.0.环顾四周,我看到Microsoft.AspNet.WebApi.Client也可能参与其中.
使用NuGet Package Manager,我删除了Microsoft.AspNet.WebApi.WebHost,Microsoft.AspNet.WebApi.Core和Microsoft.AspNet.WebApi.Client.然后我重新添加了所有3个版本的最新版本5.2.4.客户端包位于5.2.2.
现在,Web.config中System.Net.Http.Formatting的dependentAssembly有newVersion =“5.2.4.0”. DLL上的版本是5.2.60201.0,所以我期待它看到问题,但它的工作原理.寻找System.Net.Http.Formatting版本5.2.4.0似乎找到5.2.60201.0就好了,而5.2.3.0则不行.
正如我认为更好地理解它,它工作得很好.确实是一次学习经历.
最后我相信,
> Microsoft.AspNet.WebApi.WebHost
> Microsoft.AspNet.WebApi.Client
> Microsoft.AspNet.WebApi.Core
应该都是NuGet Manager中依赖项中确认的相同版本.
内容总结
以上是互联网集市为您收集整理的c# – 无法加载文件或程序集’System.Net.Http.Formatting-Cosmo’全部内容,希望文章能够帮你解决c# – 无法加载文件或程序集’System.Net.Http.Formatting-Cosmo’所遇到的程序开发问题。 如果觉得互联网集市技术教程内容还不错,欢迎将互联网集市网站推荐给程序员好友。
内容备注
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 gblab@vip.qq.com 举报,一经查实,本站将立刻删除。
内容手机端
扫描二维码推送至手机访问。