Skip to content

Commit 6d52174

Browse files
Merge pull request #6631 from MicrosoftDocs/main
Auto Publish – main to live - 2026-04-14 05:00 UTC
2 parents 7a95eae + b8f7381 commit 6d52174

12 files changed

Lines changed: 90 additions & 70 deletions

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 built with the Windows Runtime (WinRT) [BackgroundTaskBuilder](/uwp/api/windows.applicationmodel.background.backgroundtaskbuilder) API in the **Windows.ApplicationModel.Background** namespace for apps with package identity, including UWP and packaged desktop apps. 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/develop/platform/csharp-winrt/agile-objects.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
description: An agile object is one that can be accessed from any thread. C#/WinRT provides support for agile references if you need to marshal a non-agile object across apartments in a safe way.
33
title: Agile objects with C#/WinRT
4-
ms.date: 11/17/2020
4+
ms.date: 04/13/2026
55
ms.topic: article
66
ms.localizationpriority: medium
77
---
@@ -40,6 +40,6 @@ You can now pass `agileReference` to a thread in a different apartment, and use
4040

4141
```csharp
4242
await Task.Run(() => {
43-
Windows.UI.Popups.PopupMenu nonAgileObjAgain = agileReference.Get()
43+
Windows.UI.Popups.PopupMenu nonAgileObjAgain = agileReference.Get();
4444
});
4545
```

hub/apps/develop/platform/csharp-winrt/authoring.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: Author Windows Runtime components with C#/WinRT
33
description: Overview of authoring Windows Runtime Components with C#/WinRT
4-
ms.date: 03/15/2022
4+
ms.date: 04/13/2026
55
ms.topic: article
66
ms.localizationpriority: medium
77
---
@@ -11,11 +11,11 @@ ms.localizationpriority: medium
1111
> [!NOTE]
1212
> Authoring Windows Runtime components with C#/WinRT is supported on .NET 6 and later.
1313
14-
The C#/WinRT NuGet package provides support for authoring your own Windows Runtime types and components in C#, and consuming them from any Windows Runtime-compatible language such as [C++/WinRT](/windows/uwp/cpp-and-winrt-apis/) or [Rust](../../../../dev-environment/rust/rust-for-windows.md). C#/WinRT authoring and hosting support requires .NET 6 and Visual Studio 2026, and it is intended to support desktop application scenarios including the [Windows App SDK](../../../windows-app-sdk/index.md), and [WinUI3](../../../winui/winui3/index.md).
14+
The C#/WinRT NuGet package provides support for authoring your own Windows Runtime types and components in C#, and consuming them from any Windows Runtime-compatible language such as [C++/WinRT](/windows/uwp/cpp-and-winrt-apis/) or [Rust](../../../../dev-environment/rust/rust-for-windows.md). C#/WinRT authoring and hosting support requires .NET 6 or later and Visual Studio 2022 or later, and it is intended to support desktop application scenarios including the [Windows App SDK](../../../windows-app-sdk/index.md), and [WinUI3](../../../winui/winui3/index.md).
1515

16-
For a walkthrough showing how to author a Windows Runtime component with .NET 6, and how to consume it from a C++/WinRT console application, see [Walkthrough: Create a C#/WinRT component and consume it from C++/WinRT](./create-windows-runtime-component-cswinrt.md).
16+
For a walkthrough showing how to author a Windows Runtime component with .NET 6 or later, and how to consume it from a C++/WinRT console application, see [Walkthrough: Create a C#/WinRT component and consume it from C++/WinRT](./create-windows-runtime-component-cswinrt.md).
1717

18-
For more details, and to search for or file any issues, refer to the [C#/WinRT Github repo](https://github.com/microsoft/CsWinRT) and [Authoring C#/WinRT Components](https://github.com/microsoft/CsWinRT/blob/master/docs/authoring.md).
18+
For more details, and to search for or file any issues, refer to the [C#/WinRT GitHub repo](https://github.com/microsoft/CsWinRT) and [Authoring C#/WinRT Components](https://github.com/microsoft/CsWinRT/blob/master/docs/authoring.md).
1919

2020
## Declaring types in Windows Runtime components
2121

hub/apps/develop/platform/csharp-winrt/create-windows-runtime-component-cswinrt.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: Walkthrough—Create a C#/WinRT component, and consume it from C++/WinRT
33
description: Author a Windows Runtime component with C#/WinRT, and consume it from a native application.
4-
ms.date: 03/15/2022
4+
ms.date: 04/13/2026
55
ms.topic: article
66
ms.localizationpriority: medium
77
---
@@ -18,8 +18,8 @@ For a walkthrough on authoring WinUI 3 controls with C#/WinRT specifically for u
1818

1919
This walkthrough requires the following tools and components:
2020

21-
- [Visual Studio 2022](/visualstudio/releases/2022/release-notes)
22-
- [.NET 6.0 SDK](https://dotnet.microsoft.com/download/dotnet) or later
21+
- [Visual Studio 2022 or later](/visualstudio/releases/2022/release-notes)
22+
- [.NET 8.0 SDK (LTS)](https://dotnet.microsoft.com/download) or later
2323
- [C++/WinRT VSIX](https://marketplace.visualstudio.com/items?itemName=CppWinRTTeam.cppwinrt101804264) for C++/WinRT project templates
2424

2525
## Create a simple Windows Runtime Component using C#/WinRT
@@ -41,7 +41,7 @@ Begin by creating a new project in Visual Studio. Select the **Class Library** p
4141

4242
a. In Solution Explorer, right click on the project node and select **Manage NuGet Packages**.
4343

44-
b. Search for the **Microsoft.Windows.CsWinRT** NuGet package and install the latest version. This walkthrough uses C#/WinRT version 1.4.1.
44+
b. Search for the **Microsoft.Windows.CsWinRT** NuGet package and install the latest version.
4545

4646
3. Add a new `PropertyGroup` element that sets the `CsWinRTComponent` property. This specifies that your project is a Windows Runtime component so that a `.winmd` file is generated when you build the project.
4747

@@ -95,7 +95,7 @@ When you build the package, the **Build** window should indicate that the NuGet
9595
C#/WinRT authored Windows Runtime components can be consumed from any Windows Runtime (WinRT)-compatible language. The following steps demonstrate how to call the authored component above in a C++/WinRT console application.
9696

9797
> [!NOTE]
98-
> Consuming a C#/WinRT component from C#/.NET apps is supported by both package reference or project reference. This scenario is equivalent to consuming any ordinary C# class library and does not involve WinRT activation in most cases. Starting with C#/WinRT 1.3.5, project references for C# consumers require .NET 6.
98+
> Consuming a C#/WinRT component from C#/.NET apps is supported by both package reference or project reference. This scenario is equivalent to consuming any ordinary C# class library and does not involve WinRT activation in most cases. Starting with C#/WinRT 1.3.5, project references for C# consumers require .NET 6 or later.
9999

100100
1. Add a new **C++/WinRT Console Application** project to your solution. Note that this project can also be part of a different solution if you choose so.
101101

hub/apps/develop/platform/csharp-winrt/create-winrt-component-winui-cswinrt.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: Walkthrough—Create a C# component with WinUI controls, and consume it from a C++/WinRT app that uses the Windows App SDK
33
description: Author a Windows Runtime component with C#/WinRT with WinUI controls, and consume it from any Windows App SDK app.
4-
ms.date: 03/15/2022
4+
ms.date: 04/13/2026
55
ms.topic: article
66
ms.localizationpriority: medium
77
---
@@ -18,8 +18,8 @@ This walkthrough demonstrates how to author a C# component with a custom WinUI c
1818

1919
This walkthrough requires the following tools and components:
2020

21-
- [Visual Studio 2026](/visualstudio/releases/2026/release-notes)
22-
- [.NET 6.0 SDK](https://dotnet.microsoft.com/download/dotnet/6.0)
21+
- [Visual Studio 2022 or later](/visualstudio/releases/2022/release-notes)
22+
- [.NET 8.0 SDK (LTS)](https://dotnet.microsoft.com/download) or later
2323
- [Windows App SDK VSIX](../../../windows-app-sdk/downloads.md) (1.1 from the stable channel)
2424

2525
## Author your C#/WinRT component using the Windows App SDK
@@ -104,7 +104,7 @@ This walkthrough requires the following tools and components:
104104
1. You can now build the **WinUIComponentCs** project to generate a `.winmd` file for the component.
105105

106106
> [!NOTE]
107-
> You can also package the component as a NuGet package for end app consumers to reference. For more details, see [Authoring C#/WinRT components](https://github.com/microsoft/CsWinRT/blob/master/docs/authoring.md) on the C#/WinRT Github repo.
107+
> You can also package the component as a NuGet package for end app consumers to reference. For more details, see [Authoring C#/WinRT components](https://github.com/microsoft/CsWinRT/blob/master/docs/authoring.md) on the C#/WinRT GitHub repo.
108108

109109
## Reference the component from a Windows App SDK C++/WinRT app
110110

@@ -177,8 +177,8 @@ Consumption from packaged apps that use a separate **Windows Application Packagi
177177

178178
## Known issues
179179

180-
- Consuming a C# component as a project reference requires `PublishReadyToRun` to be set to `False`. See [Github Issue #1151](https://github.com/microsoft/CsWinRT/issues/1151) for more details.
181-
- Consuming a C# component built for `AnyCPU` from C++ is supported only from `x86` applications currently. `x64` and `Arm64` apps result in a runtime error similar to: *%1 is not a valid Win32 application.* See [Github Issue #1151](https://github.com/microsoft/CsWinRT/issues/1093) for more details.
180+
- Consuming a C# component as a project reference requires `PublishReadyToRun` to be set to `False`. See [GitHub Issue #1151](https://github.com/microsoft/CsWinRT/issues/1151) for more details.
181+
- Consuming a C# component built for `AnyCPU` from C++ is supported only from `x86` applications currently. `x64` and `Arm64` apps result in a runtime error similar to: *%1 is not a valid Win32 application.* See [GitHub Issue #1093](https://github.com/microsoft/CsWinRT/issues/1093) for more details.
182182

183183
## Related topics
184184

hub/apps/develop/platform/csharp-winrt/index.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
description: C#/WinRT is a tool set that provides WinRT projection support for C# code.
33
title: C#/WinRT
4-
ms.date: 05/19/2020
4+
ms.date: 04/13/2026
55
ms.topic: article
66
keywords: windows 10, uwp, standard, c#, winrt, cswinrt, projection
77
ms.localizationpriority: medium
@@ -13,7 +13,7 @@ C#/WinRT is a NuGet-packaged toolkit that provides Windows Runtime (WinRT) proje
1313

1414
C#/WinRT currently provides support for consuming WinRT APIs through the use of [Target Framework Monikers](../../../desktop/modernize/desktop-to-uwp-enhance.md) (TFMs) in .NET. Setting the TFM with a specific Windows SDK version adds references to the Windows SDK projection and runtime assemblies generated by C#/WinRT.
1515

16-
The [C#/WinRT NuGet package](https://www.nuget.org/packages/Microsoft.Windows.CsWinRT/) enables you to [create](#generate-and-distribute-an-interop-assembly) and [reference](#reference-an-interop-assembly) your own WinRT interop assemblies for .NET consumers. The latest C#/WinRT version also includes a [preview of authoring](create-windows-runtime-component-cswinrt.md) WinRT types in C#.
16+
The [C#/WinRT NuGet package](https://www.nuget.org/packages/Microsoft.Windows.CsWinRT/) enables you to [create](#generate-and-distribute-an-interop-assembly) and [reference](#reference-an-interop-assembly) your own WinRT interop assemblies for .NET consumers. The latest C#/WinRT version also supports [authoring](create-windows-runtime-component-cswinrt.md) WinRT types in C#.
1717

1818
For additional information, see the [C#/WinRT GitHub repo](https://aka.ms/cswinrt/repo).
1919

@@ -29,7 +29,7 @@ Finally, C#/WinRT is a general toolkit and is intended to support other scenario
2929

3030
## What's new
3131

32-
The latest C#/WinRT releases can be found on our [release notes](https://github.com/microsoft/CsWinRT/releases) page in the Github repo.
32+
The latest C#/WinRT releases can be found on our [release notes](https://github.com/microsoft/CsWinRT/releases) page in the GitHub repo.
3333

3434
## Usage
3535

@@ -47,7 +47,7 @@ Typically, C#/WinRT interop assemblies are referenced by application projects. B
4747

4848
If you distribute a third-party WinRT component without an official interop assembly, an application project may follow the procedure for [generating an interop assembly](#generate-and-distribute-an-interop-assembly) to generate its own private projection sources. We don't recommend this approach, because it can produce conflicting projections of the same type within a process. NuGet packaging, following the [Semantic Versioning](https://semver.org) scheme, is designed to prevent this. An official third-party interop assembly is preferred.
4949

50-
### Embedded support for WinRT types (Preview)
50+
### Embedded support for WinRT types
5151

5252
Starting with C#/WinRT version 1.4.1, support is included for embedding Windows SDK projection and runtime sources for both .NET and .NET Standard 2.0 into your library or app's output. This is useful in cases where usage of Windows SDK types is self-contained. Embedded support removes dependencies on WinRT.Runtime.dll and Microsoft.Windows.SDK.NET.dll which reduces the library or app output size. It also allows library developers to provide downlevel support and removes the need for multi-targeting.
5353

hub/apps/develop/platform/csharp-winrt/net-mappings-of-winrt-types.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: .NET mappings of WinRT types in C#/WinRT
33
description: The following table lists the mappings that C#/WinRT makes between Windows Runtime types and .NET types.
4-
ms.date: 04/19/2020
4+
ms.date: 04/13/2026
55
ms.topic: article
66
keywords: windows 10, uwp
77
ms.localizationpriority: medium
@@ -18,7 +18,7 @@ The C#/WinRT custom type mappings are categorized by types in the Windows SDK or
1818
- **WinRT types that map to .NET types with the same name and namespace.** These custom mappings are generally for performance or enhancement reasons, and are implemented directly in C#. Most of the types that have the same namespace name and type name in WinRT and .NET are structures (or types associated with structures, such as enumerations). In WinRT, structures have no members other than fields, and require helper types, which .NET hides. The .NET versions of these structures have properties and methods that provide the functionality of the hidden helper types (for example, **Windows.UI.Color**).
1919

2020
> [!NOTE]
21-
> For a list of mappings between WinRT and .NET types in the context of UWP apps, see [.NET mappings of WinRT types in UWP](/windows/apps/develop/platform/csharp-winrt/net-mappings-of-winrt-types).
21+
> For a list of mappings between WinRT and .NET types in the context of UWP apps, see [.NET mappings of Windows Runtime types](/windows/uwp/winrt-components/net-framework-mappings-of-windows-runtime-types).
2222
2323
## Mappings for WinRT types in the Windows SDK
2424

@@ -99,4 +99,4 @@ The C#/WinRT custom type mappings are categorized by types in the Windows SDK or
9999
| KeyTime | Microsoft.UI.Xaml.Media.Animation |
100100
| RepeatBehavior | Microsoft.UI.Xaml.Media.Animation |
101101
| RepeatBehaviorType | Microsoft.UI.Xaml.Media.Animation |
102-
| Matrix3D |(Microsoft.UI.Xaml.Media.Media3D |
102+
| Matrix3D | Microsoft.UI.Xaml.Media.Media3D |

0 commit comments

Comments
 (0)