You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: hub/apps/develop/notifications/app-notifications/app-notifications-console.md
+12-9Lines changed: 12 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,22 +1,23 @@
1
1
---
2
-
title: Send a local app notification from a console app
2
+
title: Use app notifications with a console app
3
3
description: Learn how to send a local app notification from a .NET console app and handle the user clicking the notification using the Windows App SDK.
4
4
ms.date: 04/08/2026
5
5
ms.topic: how-to
6
6
keywords: windows 11, windows 10, windows app sdk, winappsdk, console, send app notifications, notifications, toast notifications, how to, quickstart, c#, csharp
7
7
ms.localizationpriority: medium
8
8
---
9
9
10
-
# Send a local app notification from a console app
10
+
# Use app notifications with a console app
11
11
12
-
An app notification is a message that your app can construct and deliver to your user while they are not currently inside your app.
12
+
An app notification is a UI popup that appears outside of your app's window, delivering timely information or actions to the user. Notifications can be purely informational, can launch your app when clicked, or can trigger a background action without bringing your app to the foreground.
13
13
14
14
:::image type="content" source="images/toast-notification.png" alt-text="Screenshot of an app notification" width="628":::
15
15
16
-
This article walks you through the steps to send and handle app notifications from a .NET console app using the [Windows App SDK](/windows/apps/windows-app-sdk/). The Windows App SDK `Microsoft.Windows.AppNotifications` APIs handle all the complexity of notification registration and activation for both packaged and unpackaged apps.
16
+
This article walks you through the steps to create and send an app notification from a .NET console app, and then handle activation when the user interacts with it. This article uses the [Windows App SDK](/windows/apps/windows-app-sdk/)`Microsoft.Windows.AppNotifications` APIs.
17
17
18
-
> [!NOTE]
19
-
> For WinUI apps, see [Quickstart: App notifications in the Windows App SDK](app-notifications-quickstart.md). For other app types, see [WPF](app-notifications-wpf.md), [WinForms](app-notifications-winforms.md), or [UWP](app-notifications-uwp.md).
18
+
For an overview of app notifications and guidance for other frameworks, see [App notifications overview](index.md).
19
+
20
+
This article covers local notifications. For information about delivering notifications from a cloud service, see [Push notifications](../push-notifications/index.md).
20
21
21
22
> [!IMPORTANT]
22
23
> Notifications for elevated (admin) apps are not currently supported.
@@ -46,7 +47,7 @@ For unpackaged apps, add:
46
47
<WindowsPackageType>None</WindowsPackageType>
47
48
```
48
49
49
-
## Step 1: Register for app notifications
50
+
## Register for app notifications
50
51
51
52
In your `Main` method, register the `NotificationInvoked` handler *before* calling `Register()`. The console app must remain running to receive activation callbacks when notifications are clicked.
> For unpackaged apps, `Register()` automatically sets up the COM server registration that allows Windows to launch your app when a notification is clicked. You don't need to configure COM activation or an AUMID manually.
74
75
75
-
## Step 2: Send an app notification
76
+
## Send an app notification
76
77
77
78
Use the `AppNotificationBuilder` API to construct and send a notification.
78
79
@@ -88,7 +89,7 @@ var notification = new AppNotificationBuilder()
For the `NotificationInvoked` handler to be called, the console app must still be running when the user clicks the notification. If the app exits before the user interacts with the notification, the next click will cold-launch a new process.
0 commit comments