Search code examples
wpfuwpvisual-studio-2017nugetwindows-community-toolkit

Can't install Microsoft.Toolkit.Uwp NuGet package in WPF app


I'm losing my mind here trying to install the Microsoft.Toolkit.Uwp NuGet package into a WPF app (need the toast notifications and possibly some more stuff from UWP), but I always get the following error, no matter which version of the toolkit I'm trying to install and no matter which .NET version I target:

Could not install package 'Microsoft.Toolkit.Uwp XXX'. You are trying to install this package into a project that targets '.NETFramework,Version=ZZZ', 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.

The weird thing is that Microsoft actually sends you to the Toolkit to do the exact thing I'm trying: get toast notifications from a WPF app, as can be seen here: https://learn.microsoft.com/en-us/windows/uwp/design/shell/tiles-and-notifications/send-local-toast-desktop

Excerpt from Microsoft's website

Tried downloading the NuGet package and install it from the local source, tried downloading the whole GitHub project, but to no avail. What am I doing wrong here, guys? I can't seem to figure it out.

P.S: I can't use UWP directly, because this will be an internal company app which needs to do lots of stuff not supported by UWP.


Solution

  • The documentation tells you to download the Notifications library. The Microsoft.Toolkit.Uwp package is not compatible with WPF but the Microsoft.Toolkit.Uwp.Notifications package is.