【问题标题】:Build error when using Akavache + Mobile Center in a UWP project在 UWP 项目中使用 Akavache + Mobile Center 时生成错误
【发布时间】:2017-06-02 12:21:20
【问题描述】:

我有 UWP 应用并使用 Akavache。添加 MobileCenter NuGet 包后,我在构建应用程序时遇到了这个问题:

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

如何在不移除 Akavache 或 VSMC 的情况下修复它?

【问题讨论】:

  • 能否请您对 Eric 的 Sqlite PclRaw 存储库提出建议。
  • 我会调查此事。我很清楚问题出在哪里,但我还不知道最好的解决方案是什么。
  • 顺便说一句,复制很简单。文件新建 UWP 空白应用。添加 nuget 包 Microsoft.Azure.Mobile 和 akavache。构建。
  • 我很确定问题是由于传递引用,bundle_green 和 bundle_e_sqlite3 都被添加到您的项目中。而且我很确定解决方法是阻止其中一个。但我还没有让这个真正起作用。你可以试试这个链接的信息:docs.microsoft.com/en-us/nuget/consume-packages/…

标签: uwp akavache mobile-center visual-studio-app-center


【解决方案1】:

根据@Eric Sink 的评论,我尝试排除 Mobile Center 重复的 DLL,据我所知,Mobile Center 使用 Akavache sqlite 依赖项可以正常工作。不过我没有在运行时测试 Akavache。

我正在使用 project.json,这对我有用:

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

dependencies 对象内。

【讨论】:

  • 我没有 project.json (VS2017) *.csproj 中的所有依赖项,但是这个文件不包含 SQLitePCLRaw.bundle_green。
  • 你能上传packages.config和csproj吗?
  • 根据我的测试,排除功能不适用于 UWP csproj 中的 PackageReference。我假设 VS2017 支持旧的 project.json 东西以实现向后兼容的目的,所以如果项目被手动更改......
  • 此解决方案在 Creators update 15063 上对我有用,但如果我们使用 Fall Creators update 16299 版本,Xamarin UWP 会删除 project.json 文件。看起来它不支持最新版本。我们现在如何解决这个问题?这很烦人
  • project.json 内容已移回 csproj:docs.microsoft.com/en-us/dotnet/core/tools/…
【解决方案2】:

使用 PackageReference 消费 nugets 技术,documentation 表示使用 Exclude="All" 标志

不幸的是文档是错误的,正如github issue 所强调的那样,您实际上需要使用ExcludeAssets="All"

所以成品看起来像

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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-03-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-12-10
    相关资源
    最近更新 更多