猿问

添加 UWP 后台任务导致 AppManifest 错误

我一直在尝试向我的项目添加进程外后台任务以更新我的应用程序的实时磁贴。该任务需要调用数据库来获取一些数据,然后处理该数据以发送一些磁贴通知。

我已经设法让它在我专门为后台任务功能原型设计的一个项目中工作。但是,当我尝试向主项目添加后台任务时,出现以下错误:

Validation error. error 80080204: App manifest validation error: Line 33, Column 12, Reason: If it is not an audio background task, it is not allowed to have EntryPoint="BackgroundTasks.LiveTileTask" without ActivatableClassId in windows.activatableClass.inProcessServer.

我搜索了这个错误并找到了一些帖子说我应该添加音频任务类型并且错误会消失,但后来我得到了一个不同的错误。我什至没有尝试在后台播放音频,所以我无法理解为什么 UWP 认为我是。

我的项目设置如下所示:

  • 1 个 UWP 项目以秋季创建者的更新为最小/目标版本。

  • 1 个用于数据库的网络标准 2.0 项目(使用 EFcore)

我已经尝试遵循 Microsoft 发布的指南,并为后台任务添加一个 WinRT 项目,但这会导致我的 .net 标准 2.0 项目和 UWP 项目到处存在兼容性问题。我不是一个非常有经验的 UWP 开发人员,所以我想知道是否有人看到了我遗漏的东西。

让我的后台任务工作的最佳方法是什么?即使应用程序未打开,进程内后台任务是否足以从后台更新动态磁贴?

编辑:我使用的是最新版本的 VS 2017 (15.7.1)


jeck猫
浏览 268回答 2
2回答

慕神8447489

我遇到了同样的问题并找到了解决方案。您需要为 EntryPoint 指定完整的命名空间:&nbsp; &nbsp; &nbsp;<Extensions>&nbsp; &nbsp; &nbsp; &nbsp; <Extension Category="windows.backgroundTasks" EntryPoint="FullNameSpace.Background.ToastNotificationBackgroundTask">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <BackgroundTasks>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <Task Type="systemEvent"/>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </BackgroundTasks>&nbsp; &nbsp; &nbsp; &nbsp; </Extension>&nbsp; &nbsp; &nbsp; </Extensions>&nbsp; &nbsp; </Application>&nbsp; </Applications>
随时随地看视频慕课网APP
我要回答