简体   繁体   English

无法在Xamarin中安装SQLite-Net-pcl

[英]Impossible to install SQLite-Net-pcl in Xamarin

I am trying to convert my project from SQLite.Net-PCL to sqlite-net-pcl (latest stable version; 1.3.1), as it says on Xamarin's working with databases , but when I install it, it has to install 40 packages (or so) as listed below 我试图将我的项目从SQLite.Net-PCL转换为sqlite-net-pcl(最新的稳定版本; 1.3.1),正如它在Xamarin处理数据库时说的那样,但是当我安装它时,它必须安装40个软件包(左右)如下所列

Microsoft.NETCore.Platforms 1.0.1
Microsoft.NETCore.Targets 1.0.1
runtime.native.System   4.0.0
SQLitePCLRaw.core 1.1.2
SQLitePCLRaw.bundle_green 1.1.2
System.Collections 4.0.11
System.Collections.Concurrent 4.0.12
System.Diagnostics.Debug 4.0.11
System.Diagnostics.Tools 4.0.1
System.Diagnostics.Tracing 4.1.0
System.Globalization 4.0.11
System.IO 4.1.0
System.IO.Compression 4.1.0
System.Linq 4.1.0
System.Linq.Expressions 4.1.0
System.Net.Http 4.1.0
System.Net.Primitives 4.0.11
System.ObjectModel 4.0.12
System.Reflection 4.1.0
System.Reflection.Extensions 4.0.1
System.Reflection.Primitives 4.0.1
System.Resources.ResourceManager 4.0.1
System.Runtime 4.1.0
System.Runtime.Extensions 4.1.0
System.Runtime.InteropServices 4.1.0
System.Runtime.Numerics 4.0.1
System.Text.Encoding 4.0.11
System.Text.Encoding.Extensions 4.0.11
System.Text.RegularExpressions 4.1.0
System.Threading 4.0.11
System.Runtime.InteropServices.RuntimeInformation 4.0.0
System.Threading.Tasks 4.0.11
System.Xml.ReaderWriter 4.0.11
System.Xml.XDocument 4.0.11
NETStandard.Library 1.6.0
sqlite-net-pcl 1.3.1

I understand that it needs some packages, but it seems like a lot of packages to me. 我知道它需要一些软件包,但对我来说似乎有很多软件包。 I am using Xamarin.Forms version 2.3.3.180 (the latest stable) 我正在使用Xamarin.Forms版本2.3.3.180(最新的稳定版)

And if I continue the installation, an error like this occurs 如果我继续安装,会发生这样的错误

Could not install package 'System.Runtime.InteropServices.RuntimeInformation 4.0.0'. You are trying to install this package into a project that targets '.NETPortable,Version=v4.5,Profile=Profile111', but the package does not contain any assembly references or content files that are compatible with that framework. For more information, contact the package author.

How can I install sqlite-net-pcl, so I can continue working with SQLite on Android N? 如何安装sqlite-net-pcl,以便继续在Android N上使用SQLite?

Right now I have these targets 现在我有这些目标

.NET Framework 4.5
Windows 8
ASP.NET Core 1.0 (I do not know why this is set)
Windows Phone 8.1 (I am not using this, but it says I have to reinstall all Nuget packages, if I want to remove it)
Xamarin.Android
Xamarin.iOS
Xamarin.iOS (Classic)
Xamarin.Mac (neither using this)

Do I have to remove the targets, that I am not using and reinstall all Nuget packages? 我是否必须删除目标,我没有使用并重新安装所有Nuget包?

And I am using these NuGet packages 我正在使用这些NuGet包

Acr.UserDialogs
ExifLib.PCL
Microsoft.NETCore.UniversalWindowsPlatform
MR.Gestures
Newtonsoft.Json
Xam.Plugin.Media
Xam.Plugins.Settings
Xamarin.Forms
Xamarin.Insights
Xamarin.UITest
XLabs.Forms
ZXing.Net.Mobile.Forms

You have installed the .NetStandard version 您已安装.NetStandard版本

Release Notes v1.3.1: 发行说明v1.3.1:

Switch to .NET Standard 切换到.NET标准

As you can see NETStandard.Library 1.6.0 is now added as a package. 正如您所见, NETStandard.Library 1.6.0现已添加为包。

I would remove sqlite-net-pcl 1.3.1 and the other packages it installed for .NetStandard then use v1.2.1 as it still has the fix for Android N as it added bundle_green from here 我会删除sqlite-net-pcl 1.3.1以及为.NetStandard安装的其他软件包然后使用v1.2.1,因为它仍然有Android N的修复,因为它从这里添加了bundle_green

v1.2.1: Update .raw to bundle_green 1.1.0 v1.2.1:将.raw更新到bundle_green 1.1.0

you can read more about the fix here 你可以在这里阅读更多关于修复的内容

I'm afraid that you will have to do what you said. 我担心你必须做你说的话。 I had a similar problem (luckily it was a new project) and I had no other way then doing this. 我有一个类似的问题(幸运的是这是一个新的项目),我没有其他办法做到这一点。 You will have to remove every nuget package, change the target to remove the one that causes this error and then reinstall all packages. 您将不得不删除每个nuget包,更改目标以删除导致此错误的目标,然后重新安装所有包。 I would advise you to remove the targets one by one and try to install sqlite. 我建议你逐个删除目标并尝试安装sqlite。 You will be able to isolate the target that causes you error. 您将能够隔离导致错误的目标。

I have ported that library to pure .NET Standard. 我已将该库移植到纯.NET标准版。 I've reduced it down to one library that works on all platforms: android, iOS, uwp, etc, but I have removed the orm functionality. 我把它减少到一个适用于所有平台的库:android,iOS,uwp等,但我已经删除了orm功能。 https://github.com/MelbourneDeveloper/SQLite.Net.Standard https://github.com/MelbourneDeveloper/SQLite.Net.Standard

NuGet: SQLite.Net.Standard NuGet:SQLite.Net.Standard

I had the same issue. 我遇到过同样的问题。 I resolved mine by first installing 'System.Runtime.InteropServices.RuntimeInformation 4.0.0' and than afterwards installing the SQlite-pcl package. 我通过首先安装'System.Runtime.InteropServices.RuntimeInformation 4.0.0'而不是之后安装SQlite-pcl包解决了我的问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM