系统相关
首页 > 系统相关> > C#-UWP应用程序:无法加载文件或程序集’System.Runtime.WindowsRuntime,版本= 4.0.14.0

C#-UWP应用程序:无法加载文件或程序集’System.Runtime.WindowsRuntime,版本= 4.0.14.0

作者:互联网

我有一个使用Xamarin的.Net Standard 1.4构建的UWP应用程序,我最近升级了几个nuget插件,而我的UWP项目已经开始给我以下错误:

“System.IO.FileLoadException: Could not load file or assembly
‘System.Runtime.WindowsRuntime, Version=4.0.14.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089′. The located assembly’s manifest
definition does not match the assembly reference. (Exception from
HRESULT: 0x80131040)\r\n”

现在通常这很简单,您只需添加对该.dll的引用即可.所以我找到nuget包here并将其添加到我的UWP项目中并进行构建.

现在最初在nuget软件包页面上,我看不到版本4.0.14,但无论如何我都安装了最新版本(4.3.0).

但是我仍然遇到相同的错误,当我检查bin文件夹中该库的版本时,它报告为V4.0.12,那么我从哪里可以得到该库的V4.0.14?

额外信息

我可以在互联网上找到的此版本的DLL的唯一提及是here

The update was only was published as part of
Microsoft.NETCore.UniversalWindowsPlatform and you have to target Fall
Creator’s Update or higher for the APIs I have listed above. That gets
you the following version of the assembly (4.0.3.0 is the latest
standalone):

System.Runtime.WindowsRuntime, Version=4.0.14.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089

So scratch .NET 4.6.1 and .NET Core 2.0- only Universal Windows
Platform 10.0.16299 for now.

解决方法:

因此,该版本的库尚未作为独立软件包发布.

获取该库的唯一方法是将目标版本和最低版本提交给Fall Creators Update(如提及的here)

The update was only was published as part of
Microsoft.NETCore.UniversalWindowsPlatform and you have to target Fall
Creator’s Update or higher for the APIs I have listed above. That gets
you the following version of the assembly (4.0.3.0 is the latest
standalone):

System.Runtime.WindowsRuntime, Version=4.0.14.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089

这是由于(我的情况)我将插件Rg.Popup更新到1.1.3.73-pre版本引起的,因为它们使用的API的一部分在早期版本的Windows中不可用.我也将其作为针对Rg.Popup插件here的错误报告进行了归档.

我敢肯定,微软将把这个版本作为单独的软件包发布

澄清一下-将目标版本和最低版本从Windows 10 Build 10240更改为秋季创建者更新已为我解决了此问题

标签:net-standard,uwp,c,net
来源: https://codeday.me/bug/20191025/1928614.html