Is it possible to send Toast notification from console application?

At first you need to declare that your program will be using winRT libraries:

  1. Right-click on your yourProject, select Unload Project
  2. Right-click on your yourProject(unavailable) and click Edit yourProject.csproj
  3. Add a new property group:<targetplatformversion>8.0</targetplatformversion>
  4. Reload project
  5. Add reference Windows from Windows > Core
    enter image description here

Now you need to add this code:

using Windows.UI.Notifications;

and you will be able to send notifications using this code:

var toast = new ToastNotification(doc);
ToastNotificationManager.CreateToastNotifier().Show(toast);

Reference: How to call WinRT APIs in Windows 8 from C# Desktop Applications – WinRT Diagram

Leave a Comment