ericsink / SQLitePCL.raw

A Portable Class Library (PCL) for low-level (raw) access to SQLite
Apache License 2.0
512 stars 106 forks source link

Can't use e_sqlcipher and e_sqlite with .net 6 ios project #463

Closed jona-1993 closed 2 years ago

jona-1993 commented 2 years ago

Hello,

I would like use sqlite and sqlcipher with EF Core in my .net 6 IOS project but there are some linking errors. (With .net 6 Mac and Windows, it's ok).

My cproj: (I tested with registrar static and without, same issue)

https://pastebin.com/G3YXj6hW

My output:

https://pastebin.com/4UYHDhMt

I have that with each libraries versions. How can I make this work?

Have a nice day !

ericsink commented 2 years ago
    <PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="6.0.1" />
    <PackageReference Include="SQLitePCLRaw.lib.e_sqlcipher.ios" Version="2.0.7" />

The problem here is that Microsoft.EntityFrameworkCore.Sqlite is bringing in sqlite binaries, and then you're also bringing in the e_sqlcipher binaries as well.

Try using these two packages instead: Microsoft.EntityFrameworkCore.Sqlite.Core and SQLitePCLRaw.bundle_e_sqlcipher.

jona-1993 commented 2 years ago

Yes, it works. Thank you !

For use sqlcipher (and sqlite3), I have that:

 <ItemGroup Condition="'$(TargetFramework)' == 'net6.0-ios'">
    <PackageReference Include="Microsoft.EntityFrameworkCore" Version="6.0.1" />
    <PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite.Core" Version="6.0.1" />
    <PackageReference Include="SQLitePCLRaw.bundle_green" Version="2.0.7" />
    <PackageReference Include="SQLitePCLRaw.core" Version="2.0.7" />
    <PackageReference Include="SQLitePCLRaw.provider.e_sqlcipher" Version="2.0.7" />
    <PackageReference Include="SQLitePCLRaw.provider.e_sqlite3" Version="2.0.7" />
    <PackageReference Include="SQLitePCLRaw.bundle_e_sqlcipher" Version="2.0.7" />
    <PackageReference Include="SQLitePCLRaw.lib.e_sqlcipher.ios">
      <Version>2.0.7</Version>
    </PackageReference>
  </ItemGroup>