无法加载文件或程序集“Newtonsoft.Json,Version=9.0.0.0,Culture=neutral,PublicKeyToken=30ad4fe6b2a6aeed”或其依赖项之一

2024-02-14

我有一个 WinJS 项目,之前使用 VS 2013 在 Windows 8.1 上构建。

最近,我通过创建一个空白的 Javascript 通用 Windows 10 项目,然后添加旧项目中的所有文件,将该项目升级到通用 Windows 10。

我有 Windows 运行时组件和 SQLite 类库。

我添加了通用 Windows 运行时组件和通用类库,并将所有文件从旧项目复制到相应的位置。

不知何故,我设法消除了所有构建错误。

我安装了所有必需的 SQLite-net、SQLite for Universal Windows Platform、Newtonsoft 等。

但是当我运行应用程序并在 Windows 运行时组件中调用本机方法时,它会出现一些奇怪的错误,如下所示:

An exception of type 'System.IO.FileNotFoundException' occurred in mscorlib.ni.dll but was not handled in user code.

Additional information: Could not load file or assembly 'Newtonsoft.Json, Version=9.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed' or one of its dependencies. The system cannot find the file specified.

Newtonsoft版本是:9.0.1

My 项目.jsonWindows运行时组件的文件有以下内容:

  {
  "dependencies": {
    "Microsoft.NETCore.UniversalWindowsPlatform": "5.0.0",
    "Newtonsoft.Json": "9.0.1"
  },
  "frameworks": {
    "uap10.0": {}
  },
  "runtimes": {
    "win10-arm": {},
    "win10-arm-aot": {},
    "win10-x86": {},
    "win10-x86-aot": {},
    "win10-x64": {},
    "win10-x64-aot": {}
  }
}

我的 Visual Studio 版本是:

我尝试删除所有 Newtonsoft json 并重新安装它,但没有成功。


我通过将Newtonsoft.Json添加到启动项目的NuGet中解决了这个问题(尽管它没有直接在启动项目中使用)。

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

无法加载文件或程序集“Newtonsoft.Json,Version=9.0.0.0,Culture=neutral,PublicKeyToken=30ad4fe6b2a6aeed”或其依赖项之一 的相关文章

随机推荐