C# HRESULT 异常:0x80131040

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/9129802/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-09 06:06:00  来源:igfitidea点击:

Exception from HRESULT: 0x80131040

c#asp.netvisual-studio-2010exception

提问by Anicho

Warning 1   D:\MyPath\SomeAscx.cs: ASP.NET runtime error: 


            Could not load file or assembly 'HtmlAgilityPack, 
            Version=1.4.0.0, Culture=neutral, PublicKeyToken=bd319b19eaf3b43a'
            or one of its dependencies. The located assembly's manifest definition 
            does not match the assembly reference. (Exception from HRESULT: 0x80131040)

I have removed the reference and am not using it in code why would this still be an issue. I have tried cleaning solution, rebuilding, open and closing solution but still no success. Has anyone come across this issue before?

我已经删除了引用并且没有在代码中使用它为什么这仍然是一个问题。我尝试过清洁解决方案,重建,打开和关闭解决方案,但仍然没有成功。有没有人遇到过这个问题?

采纳答案by Strillo

Even if you removed direct references, something else might still require that dll.

即使您删除了直接引用,其他内容可能仍然需要该 dll。

I'd suggest:

我建议:

  1. Recycle your IIS application pool (or run IISRESET from the command prompt to reset the entire web server)
  2. turn on FusLogand check who is the real "offender"
  1. 回收您的 IIS 应用程序池(或从命令提示符运行 IISRESET 以重置整个 Web 服务器)
  2. 打开FusLog并检查谁是真正的“罪犯”

回答by Rosdi Kasim

This can happen if your project name conflicts with a nuget package you referenced. I wasted about 30 minutes before I realized what is going on.

如果您的项目名称与您引用的 nuget 包冲突,就会发生这种情况。我浪费了大约 30 分钟才意识到发生了什么。

I was doing a ReactJS tutorial, so I created a project called React, and then later I imported ReactJS.NET from nuget.

我正在做一个 ReactJS 教程,所以我创建了一个名为React的项目,然后我从 nuget 导入了 ReactJS.NET。

When I hit build, Visual Studio will build React.dllin bin folder since my project name is React, this dll overwrites the React.dllimported by nuget package ReactJS.NET

当我点击构建时,Visual Studio 将React.dll在 bin 文件夹中构建,因为我的项目名称是React,这个 dll 覆盖了React.dll由 nuget 包 ReactJS.NET 导入的

So my project blew up... and I wasted 30 minutes scratching my head.

所以我的项目失败了……我浪费了 30 分钟挠头。