我有一个WinJS项目,以前是在Windows8.1上使用VS 2013构建的。
最近,我通过创建一个空白Javascript通用Windows 10项目将该项目升级到通用windows 10,然后添加了旧项目中的所有文件。
我有Windows组件和用于SQLite的类库。
我添加了通用Windows运行时组件和通用类库,并将所有文件从旧项目复制到相应的位置。
不知何故,我设法删除了所有的构建错误。
我安装了所有所需的SQLite-net、SQLite for Universal平台、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.
新软件版本为: 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版本是:
我试着移除所有的Newtonsoft json,重新安装它,但没有任何进展。
发布于 2016-08-02 08:52:55
我做了一个基本的演示,并复制了这个问题。WinRT组件似乎找不到Newton.Json
的正确程序集。临时的解决办法是手动添加Newtonsoft.json.dll
文件。您可以通过以下步骤来实现这一点:
发布于 2017-12-31 13:53:31
我通过将Newtonsoft.Json添加到启动项目的NuGet中解决了这个问题(即使它不是直接用于启动项目)。
发布于 2016-11-15 20:28:58
我也有同样的问题,为了解决这个问题,如果您的项目的dependentAssembly版本已经更新(可能不更新),请在项目的References中签入,然后删除它并签入您的Web.config或App.config wheter元素,如下所示:
<dependentAssembly>
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-9.0.0.0" newVersion="9.0.0.0" />
</dependentAssembly>
在此之后,再次重新构建项目( dll将被正确的版本替换)
https://stackoverflow.com/questions/38671641
复制相似问题