7

I have UWP app and use Akavache. After adding MobileCenter NuGet packages I have this problem whith building app:

Payload contains two or more files with the same destination path 'SQLitePCLRaw.batteries_v2.dll'. 
Source files:C:\Users\user\.nuget\packages\SQLitePCLRaw.bundle_e_sqlite3\1.1.0\lib\uap10.0\SQLitePCLRaw.batteries_v2.dll
C:\Users\user\.nuget\packages\SQLitePCLRaw.bundle_green\1.1.2\lib\uap10.0\SQLitePCLRaw.batteries_v2.dll

How can I fix it without removing Akavache or VSMC?

Guillaume Perrot
  • 3,978
  • 2
  • 25
  • 33
Make Makeluv
  • 817
  • 10
  • 18
  • Can you please raise a repro on Eric's Sqlite PclRaw repo please. – Geoffrey Huntley Jun 02 '17 at 14:42
  • I'll investigate this. I've got a decent idea what the problem is, but I do not yet know what the best resolution will be. – Eric Sink Jun 02 '17 at 15:04
  • 1
    BTW, repro is simple. File New UWP blank app. Add nuget packages Microsoft.Azure.Mobile, and akavache. Build. – Eric Sink Jun 02 '17 at 15:35
  • I'm pretty sure the problem is that both bundle_green and bundle_e_sqlite3 are getting added to your project, because of transitive references. And I'm pretty sure the fix would be to block one of them. But I haven't got this to actually work. You might try info at this link: https://docs.microsoft.com/en-us/nuget/consume-packages/dependency-resolution#excluding-references – Eric Sink Jun 02 '17 at 15:46

2 Answers2

4

Based on @Eric Sink comment, I tried to the exclude the Mobile Center duplicate DLL and as far as I can tell, Mobile Center works correctly using the Akavache sqlite dependency. I didn't test Akavache at runtime though.

I am using project.json and this worked for me:

"SQLitePCLRaw.bundle_green": {
  "version": "1.1.2",
  "exclude": "all"
}

inside dependencies object.

Guillaume Perrot
  • 3,978
  • 2
  • 25
  • 33
  • I don't have project.json (VS2017) All dependencies in *.csproj, but this file don't contains SQLitePCLRaw.bundle_green. – Make Makeluv Jun 02 '17 at 20:49
  • Can you upload packages.config and the csproj somewhere? – Guillaume Perrot Jun 02 '17 at 22:10
  • Based on my testing, the exclude feature doesn't work with PackageReference in a UWP csproj. I assume VS2017 supports old project.json stuff for backwards compatibility purposes, so maybe if the project were manually changed... – Eric Sink Jun 06 '17 at 21:42
  • This solution worked for me on Creators update 15063 but if we use Fall Creators update 16299 version, Xamarin UWP removes the project.json file. it looks like that it is not supporterd with the latest version. how can we fix this now? this is pretty annoying – Emil Dec 26 '17 at 02:34
  • project.json content has been moved back to csproj: https://docs.microsoft.com/en-us/dotnet/core/tools/project-json-to-csproj – Guillaume Perrot Dec 26 '17 at 06:34
0

Using the PackageReference technique of consuming nugets the documentation says to use the Exclude="All" flag

Unfortunately the documentation is wrong, as highlighted by this github issue and you infact need to use ExcludeAssets="All"

So the finished product will look something like

<PackageReference Include="SQLitePCLRaw.bundle_green" Version="1.1.9" ExcludeAssets="All" />

user1
  • 15,594
  • 12
  • 96
  • 166