AppCenter for UWP have a dependency on sqlite-net-pcl. This poses a challenge if the project is already using SQLite in a certain way.
Specifically, if the project have opted for using sqlite-net-base in order to choose a different SQLite-net provide, such as SQLitePCLRaw.bundle_sqlcipher, which is handy if you want to add encryption to the storage of date.
In this case the result is this error:
Severity Code Description Project File Line Suppression State
Error Payload contains two or more files with the same destination path 'SQLitePCLRaw.batteries_v2.dll'. Source files:
C:\Users[...]\packages\sqlitepclraw.bundle_green\1.1.5\lib\uap10.0\SQLitePCLRaw.batteries_v2.dll
C:\Users[...]\packages\sqlitepclraw.bundle_sqlcipher\1.1.9\lib\uap10.0\SQLitePCLRaw.batteries_v2.dll
The workaround should be straight forward, i.e. to create a second set of NuGet's that references sqlite-net-base for UWP.
For iOS and Android there is currently no challenge, since there is no dependency on SQLite for those platforms.
We don't have plans to release separate NuGet packages for these scenarios, but I think you can solve the issue at the project level using these instructions. (See the section about excluding references.)
I thought so too, specifically using the guidance in the section "Excluding references", however that didn't work for me.
Maybe, there is something I don't understand. Were you thing about "Excluding references" too in the reply?
Yeah that's what I meant. Are you using project.json, packages.config, or just csproj? And did the error change at all when you made the changes?
Yes, I'm using csproj. An no, making the change did not help. Maybe, I'm doing it wrong. I just don't know what the right way is then.
Just tried to create an all new blank UWP project.
The key part of the csproj looks like this:
<ItemGroup>
<PackageReference Include="Microsoft.AppCenter">
<Version>1.1.0</Version>
</PackageReference>
<PackageReference Include="Microsoft.NETCore.UniversalWindowsPlatform">
<Version>6.0.5</Version>
</PackageReference>
<PackageReference Include="sqlite-net-base">
<Version>1.5.166-beta</Version>
</PackageReference>
<PackageReference Include="SQLitePCLRaw.bundle_sqlcipher">
<Version>1.1.9</Version>
</PackageReference>
<PackageReference Include="sqlite-net-pcl" Version="1.3.1" Exclude="All" />
</ItemGroup>
If I try and compile I get this error:
Severity Code Description Project File Line Suppression State
Error Payload contains two or more files with the same destination path 'SQLitePCLRaw.batteries_v2.dll'. Source files:
C:\Users\jaspe.nuget\packages\sqlitepclraw.bundle_green\1.1.2\lib\uap10.0\SQLitePCLRaw.batteries_v2.dll
C:\Users\jaspe.nuget\packages\sqlitepclraw.bundle_sqlcipher\1.1.9\lib\uap10.0\SQLitePCLRaw.batteries_v2.dll AppCenterSQLiteResearch
Just to give you an update- I have reproduced the issue on my end and can't seem to get the Exclude attribute to work. I'm still looking into this and will let you know when I have something.
Thank you.
Exclude attribute doesn't work. There is an error in the documentation, use ExcludeAssets see here: https://github.com/NuGet/Home/issues/6399#issuecomment-356138525
Thank you @JKennedy24
I've change the csproj to this:
...
<ItemGroup>
<PackageReference Include="Microsoft.AppCenter">
<Version>1.1.0</Version>
</PackageReference>
<PackageReference Include="Microsoft.NETCore.UniversalWindowsPlatform">
<Version>6.0.5</Version>
</PackageReference>
<PackageReference Include="sqlite-net-base">
<Version>1.5.166-beta</Version>
</PackageReference>
<PackageReference Include="sqlite-net-pcl">
<Version>1.3.1</Version>
<ExcludeAssets>All</ExcludeAssets>
</PackageReference>
<PackageReference Include="SQLitePCLRaw.bundle_sqlcipher">
<Version>1.1.9</Version>
</PackageReference>
</ItemGroup>
...
However, unfortunately the error remains the same.
What I'm trying to accomplish here is to exclude sqlite-net-pcl and all of it's assets.
sqlite-net-pcl is a dependency that comes from Microsoft.AppCenter. However, in this project I want 'sqlite-net-base' + SQLitePCLRaw.bundle_sqlcipher to be the replacement of sqlite-net-pcl.
@1iveowl the way I got it working was to use Sqlite-Net-PCL and add a SqliteRaw.Bundle_Green reference and set ExcludeAssets on the SqliteRaw.Bundle_green package.
Let me know if that works
Bingo!
Below did the trick.
What happens if at a later stage that Microsoft.AppCenter references some later version of the two excluded packages? Will I need to maintain this or can I use wildcards like Version="*"?
<ItemGroup>
<PackageReference Include="Microsoft.AppCenter">
<Version>1.1.0</Version>
</PackageReference>
<PackageReference Include="Microsoft.NETCore.UniversalWindowsPlatform">
<Version>6.0.5</Version>
</PackageReference>
<PackageReference Include="sqlite-net-base">
<Version>1.5.166-beta</Version>
</PackageReference>
<PackageReference Include="sqlite-net-pcl">
<Version>1.3.1</Version>
<ExcludeAssets>All</ExcludeAssets>
</PackageReference>
<PackageReference Include="SQLitePCLRaw.bundle_green">
<Version>1.1.2</Version>
<ExcludeAssets>All</ExcludeAssets>
</PackageReference>
<PackageReference Include="SQLitePCLRaw.bundle_sqlcipher">
<Version>1.1.9</Version>
</PackageReference>
</ItemGroup>
@1iveowl Thats a good question. I don't know the answer but I think using Version="*" may be the answer
Version="*" test confirms this.
@1iveowl I did get some trouble later on down the line using Version="* I'm not sure whether this is valid for nuget as outlined here: https://docs.microsoft.com/en-us/nuget/consume-packages/dependency-resolution#floating-versions.
It may be you can only use Version="1.*"
This solution has been proposed for 8 months and there is no other better approach. Is SQLite-Net-base reliable? Who supports it?
Hey @andrechi1,
We are tracking this feature request in our backlog but I cannot provide you with any info if/when we are working on this.
Hello,
Because my app already use
sqlite-net-base
SQLitePCLRaw.core
SQLitePCLRaw.provider.sqlite3.uwp10
I use the SQLitePCL.raw.SetProvider(new SQLitePCL.SQLite3Provider_sqlite3()); to init my local sqlite.
When I install App Center and call start method, VS got the exception on the code: SQLitePCL.raw.SetProvider(new SQLitePCL.SQLite3Provider_sqlite3());
Hey, @poumason, as of @ElektrojungeAtWork's comment, we have it tracked, but unfortunatelly no ETAs we can provide yet.
Also, just so you know, I've pinged our PMs today about same problem in App Center's portal intercom to bring this request to their attention again.
I use sqlite-net-pcl to replace :
sqlite-net-base
SQLitePCLRaw.core
SQLitePCLRaw.provider.sqlite3.uwp10
the issue be solved.
Windows Store rejects the publications because of usage e_sqlite.dll file.
The AppCenter .NET SDK does not depend on sqlite-net-pcl anymore in version 3.0.0. It however depends on https://www.nuget.org/packages/SQLitePCLRaw.bundle_green/ version 2.0.2 (which is also a dependency of sqlite-net-pcl).
However sqlite-net-pcl users might need to use the beta of sqlite-net-pcl to be compatible with AppCenter: https://www.nuget.org/packages/sqlite-net-pcl/1.7.302-beta.
Two years later, I've just added AppCenter to a perfectly functioning app and hey, presto, this error message.
(Using Microsoft.Data.Sqlite.Core with the dependency (SQLitePCLRaw.bundle_winsqlite3) that the MS documentation specifies to use on UWP.)
@deakjahn, if it helps here is the list of dependencies for my UWP app, including both AppCenter and SQLitePCLRaw.bundle_green, and they all seem to play nice with each other.
<ItemGroup>
<PackageReference Include="Microsoft.AppCenter.Analytics">
<Version>4.1.0</Version>
</PackageReference>
<PackageReference Include="Microsoft.AppCenter.Crashes">
<Version>4.1.0</Version>
</PackageReference>
<PackageReference Include="Microsoft.SourceLink.AzureRepos.Git">
<Version>1.0.0</Version>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="Microsoft.NETCore.UniversalWindowsPlatform">
<Version>6.2.11</Version>
</PackageReference>
<PackageReference Include="Microsoft.Toolkit.Uwp">
<Version>6.1.1</Version>
</PackageReference>
<PackageReference Include="Microsoft.Toolkit.Uwp.UI">
<Version>6.1.1</Version>
</PackageReference>
<PackageReference Include="Microsoft.Toolkit.Uwp.UI.Controls">
<Version>6.1.1</Version>
</PackageReference>
<PackageReference Include="Microsoft.UI.Xaml">
<Version>2.5.0</Version>
</PackageReference>
<PackageReference Include="morelinq">
<Version>3.3.2</Version>
</PackageReference>
<PackageReference Include="Newtonsoft.Json">
<Version>12.0.3</Version>
</PackageReference>
<PackageReference Include="PemUtils">
<Version>3.0.0.82</Version>
</PackageReference>
<PackageReference Include="sqlite-net-pcl">
<Version>1.7.335</Version>
</PackageReference>
<PackageReference Include="SQLiteNetExtensions">
<Version>2.1.0</Version>
</PackageReference>
<PackageReference Include="SQLitePCLRaw.bundle_green">
<Version>2.0.4</Version>
</PackageReference>
<PackageReference Include="System.IdentityModel.Tokens.Jwt">
<Version>6.8.0</Version>
</PackageReference>
<PackageReference Include="System.Text.Json">
<Version>5.0.0</Version>
</PackageReference>
<PackageReference Include="Telerik.UI.for.UniversalWindowsPlatform">
<Version>1.0.1.9-z6</Version>
</PackageReference>
<PackageReference Include="Win2D.uwp">
<Version>1.25.0</Version>
</PackageReference>
<PackageReference Include="WinPixEventRuntime">
<Version>1.0.200127001</Version>
</PackageReference>
</ItemGroup>
Although you don't use Microsoft.Data.Sqlite.Core... But I also tried the green version and it seems to work for me, too, so I mentioned this in Eric's issue queue: https://github.com/ericsink/SQLitePCL.raw/issues/229 He should be in a better position to judge what the real issue is.
Hi @deakjahn, do you still have any issues after switching to the green version?
No, although I don't say I exercise every single muscle of SQLite in my app. But reading, writing, transcations, all seem to work so far.
Most helpful comment
Hey @andrechi1,
We are tracking this feature request in our backlog but I cannot provide you with any info if/when we are working on this.