locked
Add SQLite.Net-PCL to .NET Standard 2.0 project RRS feed

  • Question

  • User257550 posted

    Hi Xamariners,

    I want to add the SQLite.Net-PCL NuGet to my .NET Standard project and I have the following errors :

    Package SQLite.Net.Core-PCL 3.1.1 is not compatible with netstandard1.6 (.NETStandard,Version=v1.6). Package SQLite.Net.Core-PCL 3.1.1 supports: portable-net45+win8+wp8+wpa81 (.NETPortable,Version=v0.0,Profile=Profile259)

    Is there a way to get this package work with a .NET Standard project without to downgrade to PCL ?

    I used to work with Shared project and I'm migrating to .NET standard...

    Florian.

    Thursday, November 2, 2017 4:43 PM

Answers

  • User257550 posted

    I use many lib (async, extensions) depending on SQLite.Net-PCL. I successfully added the lib thanks to @CameronMoten !

    Here my csproj :

    <Project Sdk="Microsoft.NET.Sdk">
    
      <PropertyGroup>
        <TargetFramework>netstandard2.0</TargetFramework>
        <PackageTargetFallback>$(PackageTargetFallback);portable-win+net45+wp8+win81+wpa8</PackageTargetFallback>
    
      </PropertyGroup>
    
      <ItemGroup>
        <PackageReference Include="SQLite.Net-PCL" Version="3.1.1" />
        <PackageReference Include="SQLite.Net.Async-PCL" Version="3.1.1" />
        <PackageReference Include="SQLiteNetExtensions" Version="2.0.0-alpha2" />
        <PackageReference Include="SQLiteNetExtensions.Async" Version="2.0.0-alpha2" />
      </ItemGroup>
    </Project>
    

    Here the source : https://www.cameronmoten.com/2017/08/19/fixing-xamarin-with-net-standard-in-visual-studio-2017-v-15-3/

    • Marked as answer by Anonymous Thursday, June 3, 2021 12:00 AM
    Friday, November 3, 2017 8:32 AM
  • User18049 posted

    If your project targets .NET Standard 2.0 then you should not need to add a target fallback if you have the .NET Core 2.0 SDK installed. If .NET Core 2.0 SDK is installed then a .NET Standard 2.0 sdk project will have an AssetTargetFallback of net461 which will allow PCL NuGet packages to be used. Also the PackageTargetFallback is deprecated and replaced with the AssetTargetFallback property in .NET Core 2.0. I would guess you are having this problem since you do not have the .NET Core 2.0 SDK installed.

    The PackageTargetFallback is required if you have .NET Core 1.0 SDK installed and are using a .NET Standard 1.x project.

    • Marked as answer by Anonymous Thursday, June 3, 2021 12:00 AM
    Friday, November 3, 2017 12:53 PM

All replies

  • User342899 posted

    Did you try to use sqlite-net-pcl by Frank A. Krueger instead?

    Friday, November 3, 2017 1:33 AM
  • User257550 posted

    I use many lib (async, extensions) depending on SQLite.Net-PCL. I successfully added the lib thanks to @CameronMoten !

    Here my csproj :

    <Project Sdk="Microsoft.NET.Sdk">
    
      <PropertyGroup>
        <TargetFramework>netstandard2.0</TargetFramework>
        <PackageTargetFallback>$(PackageTargetFallback);portable-win+net45+wp8+win81+wpa8</PackageTargetFallback>
    
      </PropertyGroup>
    
      <ItemGroup>
        <PackageReference Include="SQLite.Net-PCL" Version="3.1.1" />
        <PackageReference Include="SQLite.Net.Async-PCL" Version="3.1.1" />
        <PackageReference Include="SQLiteNetExtensions" Version="2.0.0-alpha2" />
        <PackageReference Include="SQLiteNetExtensions.Async" Version="2.0.0-alpha2" />
      </ItemGroup>
    </Project>
    

    Here the source : https://www.cameronmoten.com/2017/08/19/fixing-xamarin-with-net-standard-in-visual-studio-2017-v-15-3/

    • Marked as answer by Anonymous Thursday, June 3, 2021 12:00 AM
    Friday, November 3, 2017 8:32 AM
  • User18049 posted

    If your project targets .NET Standard 2.0 then you should not need to add a target fallback if you have the .NET Core 2.0 SDK installed. If .NET Core 2.0 SDK is installed then a .NET Standard 2.0 sdk project will have an AssetTargetFallback of net461 which will allow PCL NuGet packages to be used. Also the PackageTargetFallback is deprecated and replaced with the AssetTargetFallback property in .NET Core 2.0. I would guess you are having this problem since you do not have the .NET Core 2.0 SDK installed.

    The PackageTargetFallback is required if you have .NET Core 1.0 SDK installed and are using a .NET Standard 1.x project.

    • Marked as answer by Anonymous Thursday, June 3, 2021 12:00 AM
    Friday, November 3, 2017 12:53 PM
  • User257550 posted

    Thank you mattward. In deed I do not have the .NET Core 2.0 SDK installed. I will try.

    Friday, November 3, 2017 12:57 PM
  • User371637 posted

    @mattward said: If your project targets .NET Standard 2.0 then you should not need to add a target fallback if you have the .NET Core 2.0 SDK installed. If .NET Core 2.0 SDK is installed then a .NET Standard 2.0 sdk project will have an AssetTargetFallback of net461 which will allow PCL NuGet packages to be used. Also the PackageTargetFallback is deprecated and replaced with the AssetTargetFallback property in .NET Core 2.0. I would guess you are having this problem since you do not have the .NET Core 2.0 SDK installed.

    The PackageTargetFallback is required if you have .NET Core 1.0 SDK installed and are using a .NET Standard 1.x project.

    How can I add .Net Core 2.0? I tried from Solution -> shared project -> dependencies -> SDK folder but there is no option. Any help?

    Thursday, September 20, 2018 5:12 PM
  • User18049 posted

    You can find older .NET Core SDKs from the .NET Core download archives and install it separately. Not sure if that helps with what you are trying to do.

    Thursday, September 20, 2018 10:16 PM
  • User42522 posted

    @flchaux said: Hi Xamariners,

    I want to add the SQLite.Net-PCL NuGet to my .NET Standard project and I have the following errors :

    Package SQLite.Net.Core-PCL 3.1.1 is not compatible with netstandard1.6 (.NETStandard,Version=v1.6). Package SQLite.Net.Core-PCL 3.1.1 supports: portable-net45+win8+wp8+wpa81 (.NETPortable,Version=v0.0,Profile=Profile259)

    Is there a way to get this package work with a .NET Standard project without to downgrade to PCL ?

    I used to work with Shared project and I'm migrating to .NET standard...

    Florian.

    Is there any specific reason to use the package you mentioned above?

    I am not seeing as it works with .NET Standard on NuGet. See the screenshot below.

    Friday, September 21, 2018 3:07 AM