【发布时间】:2016-12-04 22:16:17
【问题描述】:
我有一个以前使用 VS 2013 在 Windows 8.1 上构建的 WinJS 项目。
最近我通过创建一个空白的 Javascript Universal windows 10 项目将该项目升级到 Universal 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
我的 Windows 运行时组件的 project.json 文件有以下内容:
{
"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 并重新安装它,但没有成功。
【问题讨论】:
-
不久前我在一个新的 ASP.NET Core 应用程序中遇到了类似的问题。结果发现其中一个引用的库使用了低于 9.0.0.0 的 Newtonsoft.Json 版本。所以我升级了那个库的版本,问题就解决了。不确定您是否可以在这里做同样的事情。
-
嗨@hbulens,我尝试安装最新版本,但一次又一次出现同样的错误。
-
可能与您的问题有关 - github.com/aspnet/Home/issues/1609
-
@hbulens 您应该发表您的评论作为答案。这解决了我的问题。
标签: c# visual-studio win-universal-app windows-10 windows-10-universal