Wpf 找不到ToastContentBuilder

Wpf 找不到ToastContentBuilder,wpf,windows,winforms,.net-core,uwp,Wpf,Windows,Winforms,.net Core,Uwp,我正在尝试在我的Windows应用程序中使用toast通知,我正在使用以下代码 new ToastContentBuilder() .AddText("Hello"); 但我得到了以下错误 error CS0246: The type or namespace name 'ToastContentBuilder' could not be found (are you missing a using directive or an assembly referenc

我正在尝试在我的Windows应用程序中使用toast通知,我正在使用以下代码

new ToastContentBuilder()
    .AddText("Hello");
但我得到了以下错误

error CS0246: The type or namespace name 'ToastContentBuilder' could not be found (are you missing a using directive or an assembly reference?)
你需要安装这个软件

在Visual Studio的解决方案资源管理器中,右键单击项目,单击“管理NuGet软件包”,搜索“uwp通知”,然后安装Microsoft.Toolkit.uwp.notifications软件包

然后,IntelliSense应该建议添加以下using语句

using Microsoft.Toolkit.Uwp.Notifications;
在那之后,一切都应该正常