gpt4 book ai didi

c# - 安装 UWP 通知 nuget 包

转载 作者:太空宇宙 更新时间:2023-11-03 12:16:30 24 4
gpt4 key购买 nike

我正在尝试安装

  • Microsoft.Toolkit.Uwp.Notifications - 版本 2.2.0

以下解决方案结构的 Nuget 包。

JSProj (universal App) - Targeting build 10586
contains js App which has CSProj reference and can call C# method
packages
- Microsoft.Toolkit.Uwp.Notifications.JavaScript
- Microsoft.NETCore.UniversalWindowsPlatform
CSProj (universal App) - Targeting build 10586
contains C# methods that can be performed.
packages
- Microsoft.NETCore.UniversalWindowsPlatform

对于 JS 项目,Microsoft.Toolkit.Uwp.Notifications 因抛出错误而安装失败,

Could not install package 'Microsoft.NETCore.Jit 2.0.6'. You are trying to install this package into a project that targets 'UAP,Version=v10.0.10586', but the package does not contain any assembly references or content files that are compatible with that framework. For more information, contact the package author.


但它在 CSProj 中运行良好,但当我尝试在 C# 方法中调用通知时,会为包抛出运行时 IOException

我尝试降级包版本,并更改​​目标版本。但似乎没有任何效果。

最佳答案

您可以从 JS 项目引用的任何内容都必须是 Windows 运行时组件。作为GitHub readme对于 UWP 社区工具包状态:

There's two notification projects...

  • Microsoft.Toolkit.Uwp.Notifications
  • Microsoft.Toolkit.Uwp.Notifications.JavaScript

The first project is where all the code is contained. The JavaScript project is just for packaging the WinMD to work for WinJS projects.

这意味着如果您想使用通知,您必须直接使用 Microsoft.Toolkit.Uwp.Notifications.JavaScript 包,或者使用 Microsoft.Toolkit 构建 Windows 运行时组件。 Uwp.Notifications 并提供一个 WinRT 安全类,您将从 JavaScript 使用该类来访问该功能。

关于c# - 安装 UWP 通知 nuget 包,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49528330/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com