1

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.

Mariuselix
  • 23
  • 7
  • You can try looking at this link https://blogs.windows.com/buildingapps/2017/01/25/calling-windows-10-apis-desktop-application/ - link only answers are banned but this might help you out - it's not possible to reference some UWP libraries in .NET Framework this will be one of them but the steps to use Windows 10 APIs might help – RoguePlanetoid Sep 24 '18 at 10:17

1 Answers1

2

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.

mm8
  • 163,881
  • 10
  • 57
  • 88
  • Indeed, just the notifications package can be installed in a WPF project, so I will mark/accept your answer. I was hoping though to be able to install the whole Toolkit and use some more stuff from it (not just notifications), but it looks like that is not happening. BR! – Mariuselix Sep 25 '18 at 12:10
  • @Mariuselix only certain parts of the toolkit work with WPF. There will be more coming in the next 5.0 release coming soon. Generally they'll have a specific package to install like the notifications one here. The Microsoft.Toolkit.Uwp package itself is a dependency package which has helpers that other packages use. – Michael Hawker - MSFT Oct 27 '18 at 05:54
  • How to access Microsoft.Toolkit.Uwp SystemInformation from WPF ? It does have some very useful properties.. – Franck E Mar 30 '22 at 12:29