Avatar ·

C# 中的错误 "The located assembly's manifest definition does not match the assembly reference"

大家好!我是 C# 新手,在编译或运行项目时遇到了一个错误: "The located assembly's manifest definition does not match the assembly reference" 我有一个包含多个项目的解决方案。在一个项目(MyApp)中,我使用了 Newtonsoft.Json 库版本 12.0.3。在另一个项目(MyLibrary)中,我也使用了 Newtonsoft.Json,但版本是 11.0.1。一切编译正常,但运行时出现这个错误。以下是代码示例: ```csharp // MyApp.csproj // MyLibrary.csproj ``` 错误本身看起来像这样: ``` Could not load file or assembly 'Newtonsoft.Json, Version=11.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. ``` 我尝试过通过 NuGet 重新安装包、清理解决方案,但问题依旧。