c# - 无法加载文件或程序集...参数不正确

标签 c# exception compiler-construction compiler-errors

最近我在 C# 解决方案中遇到了以下异常:

Error 2 Could not load file or assembly 'Newtonsoft.Json, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b9a188c8922137c6' or one of its dependencies. The parameter is incorrect. (Exception from HRESULT: 0x80070057 (E_INVALIDARG))

这既不取决于我的代码也不取决于程序集的名称(在本例中为 Newtonsoft.Json)。

当我从解决方案中删除此 dll 时,编译器会在同一异常中告知另一个。所以我想应该在我的电脑上关闭/打开某些东西:)

最佳答案

看起来像是引用了损坏的程序集。

清除两者:

  1. 项目的\bin 文件夹

  2. 临时文件夹(在 Windows 7 中应该是 C:\Users\your_username\AppData\Local\Temp\Temporary ASP.NET Files)

看看错误是否仍然发生

关于c# - 无法加载文件或程序集...参数不正确,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8269386/

相关文章:

c# - 在运行时将对象转换为泛型类型

c# - 参数组合的 ArgumentException

c++ - 我在哪里可以学习有关C++编译器的 “what I need to know”?

compiler-construction - 如何使用 fsc.exe (F#) 或 csc.exe (C#) 包含 app.config 文件?

c# - Controller 返回当前 View

C#克隆一个交叉引用列表

c# - LINQ 还是其他?

python - 错误异常处理python程序

java - 奇怪的 java.lang.ArrayIndexOutOfBoundsException : -1

python - 编译Python,为什么会忽略一些错误的东西?