Skip to content

Commit b2acc11

Browse files
Improve discoverability of Windows App SDK background task docs
Addresses ADO #564910 (user feedback: friction finding OOP background task docs for Windows App SDK). Changes: - Add note at top of UWP background task article pointing clearly to the Windows App SDK equivalent and migration guide - Fix sample branch links in migration guide: release/experimental -> main - Replace bare 'here' links with descriptive text in migration guide - Add anchor link from OOP section to the code examples section below - Rename TOC entry from generic 'Working with background tasks in Windows apps' to 'Background tasks with UWP BackgroundTaskBuilder' to distinguish it from the Windows App SDK equivalent Co-authored-by: Copilot <[email protected]>
1 parent c28774d commit b2acc11

2 files changed

Lines changed: 7 additions & 4 deletions

File tree

hub/apps/develop/launch/create-and-register-a-background-task.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ dev_langs:
1515

1616
# Working with background tasks in Windows apps
1717

18+
> [!NOTE]
19+
> This article covers background tasks using the UWP app model ([BackgroundTaskBuilder](/uwp/api/windows.applicationmodel.background.backgroundtaskbuilder) in the **Windows.ApplicationModel.Background** namespace). If you're building a new app or migrating an existing app to Windows App SDK, see [Using background tasks in Windows apps](/windows/apps/windows-app-sdk/applifecycle/background-tasks) and [Background task migration strategy](/windows/apps/windows-app-sdk/migrate-to-windows-app-sdk/guides/background-task-migration-strategy).
20+
1821
Learn how to create and register a background task in your app with the Windows Runtime (WinRT) [BackgroundTaskBuilder](/uwp/api/windows.applicationmodel.background.backgroundtaskbuilder) class.
1922

2023
## Register a background task

hub/apps/windows-app-sdk/migrate-to-windows-app-sdk/guides/background-task-migration-strategy.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,17 +20,17 @@ In the case of out-of-proc background tasks in UWP, background tasks will be wri
2020

2121
If the application needs to run a background task in a medium IL process itself, the full trust COM component needs to be used for background tasks. In that scenario, developers must use the Windows App SDK [BackgroundTaskBuilder](/windows/windows-app-sdk/api/winrt/microsoft.windows.applicationmodel.background.backgroundtaskbuilder) to register the full trust COM component. Note that the [BackgroundTaskBuilder](/uwp/api/windows.applicationmodel.background.backgroundtaskbuilder) API from the **Windows.ApplicationModel.Background** namespace will throw exceptions while registering of some of the triggers.
2222

23-
A full WinUI background task registration sample can be found on [GitHub](https://github.com/microsoft/WindowsAppSDK-Samples/tree/release/experimental/Samples/BackgroundTask).
23+
A full WinUI background task registration sample can be found on [GitHub](https://github.com/microsoft/WindowsAppSDK-Samples/tree/main/Samples/BackgroundTask).
2424

25-
More details on the implementation are available [here](/windows/uwp/launch-resume/create-and-register-a-winmain-background-task). The only required change would be to replace the WinRT [BackgroundTaskBuilder](/uwp/api/windows.applicationmodel.background.backgroundtaskbuilder) API with the Windows App SDK API [Microsoft.Windows.ApplicationModel.Background.BackgroundTaskBuilder](/windows/windows-app-sdk/api/winrt/microsoft.windows.applicationmodel.background.backgroundtaskbuilder).
25+
More details on the implementation are available in [Create and register a Win32 background task](/windows/uwp/launch-resume/create-and-register-a-winmain-background-task). The only required change would be to replace the WinRT [BackgroundTaskBuilder](/uwp/api/windows.applicationmodel.background.backgroundtaskbuilder) API with the Windows App SDK API [Microsoft.Windows.ApplicationModel.Background.BackgroundTaskBuilder](/windows/windows-app-sdk/api/winrt/microsoft.windows.applicationmodel.background.backgroundtaskbuilder). For registration code examples, see the [Windows App SDK BackgroundTaskBuilder API](#windows-app-sdk-backgroundtaskbuilder-api) section below.
2626

2727
## In-proc background tasks
2828

2929
For in-proc background tasks in UWP, background task routines are implemented in the [OnBackgroundActivated](/uwp/api/windows.ui.xaml.application.onbackgroundactivated) callback which runs as part of the foreground process. This won't be possible in a WinUI application as the **OnBackgroundActivated** callbacks aren't available. The application needs to move the background task implementations to full trust COM tasks as described above and define the COM server in the package manifest to handle the COM activation of the task. When the trigger occurs, COM activation will happen on the corresponding [COM Coclass](/windows/uwp/cpp-and-winrt-apis/author-coclasses#implement-the-coclass-and-class-factory) registered for the trigger.
3030

31-
A full WinUI background task registration sample can be found on [GitHub](https://github.com/microsoft/WindowsAppSDK-Samples/tree/release/experimental/Samples/BackgroundTask).
31+
A full WinUI background task registration sample can be found on [GitHub](https://github.com/microsoft/WindowsAppSDK-Samples/tree/main/Samples/BackgroundTask).
3232

33-
More details on the implementation are available [here](/windows/uwp/launch-resume/create-and-register-a-winmain-background-task). The only change would be to replace the WinRT [BackgroundTaskBuilder](/uwp/api/windows.applicationmodel.background.backgroundtaskbuilder) API with the Windows App SDK APIs in [Microsoft.Windows.ApplicationModel.Background.BackgroundTaskBuilder](/windows/windows-app-sdk/api/winrt/microsoft.windows.applicationmodel.background.backgroundtaskbuilder).
33+
More details on the implementation are available in [Create and register a Win32 background task](/windows/uwp/launch-resume/create-and-register-a-winmain-background-task). The only change would be to replace the WinRT [BackgroundTaskBuilder](/uwp/api/windows.applicationmodel.background.backgroundtaskbuilder) API with the Windows App SDK APIs in [Microsoft.Windows.ApplicationModel.Background.BackgroundTaskBuilder](/windows/windows-app-sdk/api/winrt/microsoft.windows.applicationmodel.background.backgroundtaskbuilder).
3434

3535
## Windows App SDK BackgroundTaskBuilder API
3636

0 commit comments

Comments
 (0)