Microsoft.Windows.CppWinRT 2.0.190425.5

C++/WinRT is a standard C++ language projection for the Windows Runtime implemented solely in header files. It allows you to both author and consume Windows Runtime APIs using any standards-compliant C++ compiler. C++/WinRT is designed to provide C++ developers with first-class access to the modern Windows API.

There is a newer version of this package available.
See the version list below for details.

Requires NuGet 2.5 or higher.

Install-Package Microsoft.Windows.CppWinRT -Version 2.0.190425.5
dotnet add package Microsoft.Windows.CppWinRT --version 2.0.190425.5
<PackageReference Include="Microsoft.Windows.CppWinRT" Version="2.0.190425.5" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Microsoft.Windows.CppWinRT --version 2.0.190425.5
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Microsoft.Windows.CppWinRT, 2.0.190425.5"
#r directive can be used in F# Interactive, C# scripting and .NET Interactive. Copy this into the interactive tool or source code of the script to reference the package.
// Install Microsoft.Windows.CppWinRT as a Cake Addin
#addin nuget:?package=Microsoft.Windows.CppWinRT&version=2.0.190425.5

// Install Microsoft.Windows.CppWinRT as a Cake Tool
#tool nuget:?package=Microsoft.Windows.CppWinRT&version=2.0.190425.5
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

Microsoft.Windows.CppWinRT NuGet Package

Overview

Please visit Microsoft.Windows.CppWinRT for official Microsoft-signed builds of the NuGet package. See also the C++/WinRT VSIX, which provides C++/WinRT project templates and debug visualization.

To add build support for C++/WinRT vcxproj projects, add a reference to the Microsoft.Windows.CppWinRT NuGet package. This customizes your project's build rules to automatically generate C++/WinRT projection headers, enabling you to both consume and produce Windows Runtime classes.

C++/WinRT detects Windows metadata referenced by the project, from:

  • Platform winmd files in the SDK (both MSI and NuGet)
  • NuGet packages containing winmd files
  • Other projects producing winmd files
  • Raw winmd files
  • Interface definition language (IDL) files in the project

For any winmd file referenced by the project, C++/WinRT creates reference (consuming) projection headers. Client code can simply #include these headers, which are created in the generated files directory (see below).

For any IDL file contained in the project, C++/WinRT creates component (producing) projection headers. In addition, C++/WinRT generates templates and skeleton implementations for each runtime class, under the generated files directory.

Details

C++/WinRT configures build rules for the following tools:

  • C++ compiler
  • C++/WinRT compiler
  • MdMerge utility
  • Midlrt utility
  • Xaml compiler

It sets the following project properties and item metadata:

| Property | Value | Description | |-|-|-| | PreferredToolArchitecture | x64 | Enables the compiler to use more memory | | CanReferenceWinRT | true | Enables native project references (e.g., to WinMD files) | | GeneratedFilesDir | *$(IntDir)Generated Files\ | Sets the folder for C++/WinRT generated source files | | XamlLanguage | CppWinRT | Directs the Xaml compiler to generate C++/WinRT code | | ClCompile.CompileAsWinRT | *false | Enables ISO C++ compilation (disables C++/CX) | | ClCompile.LanguageStandard | *stdcpp17 | Enables C++17 language features | | ClCompile.AdditionalOptions | /bigobj /await | Enables support for large object files and coroutines | | ClCompile.AdditionalIncludeDirectories | GeneratedFilesDir | Adds $(GeneratedFilesDir) to the C++ include dirs | | Link.AdditionalDependencies | WindowsApp.lib | Umbrella library for Windows Runtime imports | | Midl.AdditionalOptions | /reference ... | Enables faster compilation with winmd references (versus idl imports) | | Midl.EnableWindowsRuntime | true | Enables Windows Runtime semantics | | Midl.MetadataFileName | Unmerged%(Filename).winmd | Generates unmerged metadata in a tempoary location | | Midl.GenerateClientFiles, GenerateServerFiles, GenerateStublessProxies, GenerateTypeLibrary, HeaderFileName, DllDataFileName, InterfaceIdentifierFileName, ProxyFileName, TypeLibraryName | *nul, *None, *false | Disable unnecessary output | *If not already set

Generated Files

The generated files directory created by C++/WinRT contains two subfolders:

  • sources: runtime class skeleton implementations
  • winrt: reference projection headers

Customizing

C++/WinRT behavior can be customized with these project properties:

| Property | Value | Description | |-|-|-| | CppWinRTLibs | *true | false | Enables the Link item metadata settings above | | CppWinRTModernIDL | *true | false | Enables the Midl item metadata settings above | | CppWinRTVerbosity | low | *normal | high | Sets the importance of C++/WinRT build messages (see below) | | CppWinRTNamespaceMergeDepth | *1 | Sets the depth of namespace merging (Xaml apps require 1) | | CppWinRTUsePrefixes | *false | true | Uses a dotted prefix namespace convention (versus a nested folder convention) | | CppWinRTPath | ...\cppwinrt.exe | NuGet package-relative path to cppwinrt.exe, for custom build rule invocation | *Default value

To customize the above properties, a property sheet can be added to the project:

  • right-click the project node
  • select Add | New Item... | Visual C++ | Property Sheets | Property Sheet (.props)
  • edit the resulting property sheet file
  • add the necessary project customizations
  • select View | Other Windows | Property Manager
  • right-click the project node
  • select Add Existing Property Sheet...
  • select the new property sheet file

Alternatively, the project file can be edited directly:

  • right-click the project node
  • select Unload Project
  • right-click the project node
  • select Edit <project>.vcxproj
  • add the necessary project customizations
  • right-click the project node
  • select Reload Project and close the editor

Finally, a standalone props or targets file can be injected into your project as described here. However, this technique does not work well with automated builds.

Troubleshooting

The msbuild verbosity level maps to msbuild message importance as follows:

| Verbosity | Importance | |-|-| | q[uiet] | n/a | | m[inimal] | high | | n[ormal] | normal+ | | d[etailed], diag[nostic] | low+ | For example, if the verbosity is set to minimal, then only messages with high importance are generated. However, if the verbosity is set to diagnostic, then all messages are generated.

The default importance of C++/WinRT build messages is 'normal', but this can be overridden with the CppWinRTVerbosity property to enable throttling of C++/WinRT messages independent of the overall verbosity level.

Example:

msbuild project.vcxproj /vebosity:minimal /property:CppWinRTVerbosity=high ...

For more complex analysis of build errors, the MSBuild Binary and Structured Log Viewer is highly recommended.

Microsoft.Windows.CppWinRT NuGet Package

Overview

Please visit Microsoft.Windows.CppWinRT for official Microsoft-signed builds of the NuGet package. See also the C++/WinRT VSIX, which provides C++/WinRT project templates and debug visualization.

To add build support for C++/WinRT vcxproj projects, add a reference to the Microsoft.Windows.CppWinRT NuGet package. This customizes your project's build rules to automatically generate C++/WinRT projection headers, enabling you to both consume and produce Windows Runtime classes.

C++/WinRT detects Windows metadata referenced by the project, from:

  • Platform winmd files in the SDK (both MSI and NuGet)
  • NuGet packages containing winmd files
  • Other projects producing winmd files
  • Raw winmd files
  • Interface definition language (IDL) files in the project

For any winmd file referenced by the project, C++/WinRT creates reference (consuming) projection headers. Client code can simply #include these headers, which are created in the generated files directory (see below).

For any IDL file contained in the project, C++/WinRT creates component (producing) projection headers. In addition, C++/WinRT generates templates and skeleton implementations for each runtime class, under the generated files directory.

Details

C++/WinRT configures build rules for the following tools:

  • C++ compiler
  • C++/WinRT compiler
  • MdMerge utility
  • Midlrt utility
  • Xaml compiler

It sets the following project properties and item metadata:

| Property | Value | Description | |-|-|-| | PreferredToolArchitecture | x64 | Enables the compiler to use more memory | | CanReferenceWinRT | true | Enables native project references (e.g., to WinMD files) | | GeneratedFilesDir | *$(IntDir)Generated Files\ | Sets the folder for C++/WinRT generated source files | | XamlLanguage | CppWinRT | Directs the Xaml compiler to generate C++/WinRT code | | ClCompile.CompileAsWinRT | *false | Enables ISO C++ compilation (disables C++/CX) | | ClCompile.LanguageStandard | *stdcpp17 | Enables C++17 language features | | ClCompile.AdditionalOptions | /bigobj /await | Enables support for large object files and coroutines | | ClCompile.AdditionalIncludeDirectories | GeneratedFilesDir | Adds $(GeneratedFilesDir) to the C++ include dirs | | Link.AdditionalDependencies | WindowsApp.lib | Umbrella library for Windows Runtime imports | | Midl.AdditionalOptions | /reference ... | Enables faster compilation with winmd references (versus idl imports) | | Midl.EnableWindowsRuntime | true | Enables Windows Runtime semantics | | Midl.MetadataFileName | Unmerged%(Filename).winmd | Generates unmerged metadata in a tempoary location | | Midl.GenerateClientFiles, GenerateServerFiles, GenerateStublessProxies, GenerateTypeLibrary, HeaderFileName, DllDataFileName, InterfaceIdentifierFileName, ProxyFileName, TypeLibraryName | *nul, *None, *false | Disable unnecessary output | *If not already set

Generated Files

The generated files directory created by C++/WinRT contains two subfolders:

  • sources: runtime class skeleton implementations
  • winrt: reference projection headers

Customizing

C++/WinRT behavior can be customized with these project properties:

| Property | Value | Description | |-|-|-| | CppWinRTLibs | *true | false | Enables the Link item metadata settings above | | CppWinRTModernIDL | *true | false | Enables the Midl item metadata settings above | | CppWinRTVerbosity | low | *normal | high | Sets the importance of C++/WinRT build messages (see below) | | CppWinRTNamespaceMergeDepth | *1 | Sets the depth of namespace merging (Xaml apps require 1) | | CppWinRTUsePrefixes | *false | true | Uses a dotted prefix namespace convention (versus a nested folder convention) | | CppWinRTPath | ...\cppwinrt.exe | NuGet package-relative path to cppwinrt.exe, for custom build rule invocation | *Default value

To customize the above properties, a property sheet can be added to the project:

  • right-click the project node
  • select Add | New Item... | Visual C++ | Property Sheets | Property Sheet (.props)
  • edit the resulting property sheet file
  • add the necessary project customizations
  • select View | Other Windows | Property Manager
  • right-click the project node
  • select Add Existing Property Sheet...
  • select the new property sheet file

Alternatively, the project file can be edited directly:

  • right-click the project node
  • select Unload Project
  • right-click the project node
  • select Edit <project>.vcxproj
  • add the necessary project customizations
  • right-click the project node
  • select Reload Project and close the editor

Finally, a standalone props or targets file can be injected into your project as described here. However, this technique does not work well with automated builds.

Troubleshooting

The msbuild verbosity level maps to msbuild message importance as follows:

| Verbosity | Importance | |-|-| | q[uiet] | n/a | | m[inimal] | high | | n[ormal] | normal+ | | d[etailed], diag[nostic] | low+ | For example, if the verbosity is set to minimal, then only messages with high importance are generated. However, if the verbosity is set to diagnostic, then all messages are generated.

The default importance of C++/WinRT build messages is 'normal', but this can be overridden with the CppWinRTVerbosity property to enable throttling of C++/WinRT messages independent of the overall verbosity level.

Example:

msbuild project.vcxproj /vebosity:minimal /property:CppWinRTVerbosity=high ...

For more complex analysis of build errors, the MSBuild Binary and Structured Log Viewer is highly recommended.

Dependencies

This package has no dependencies.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on Microsoft.Windows.CppWinRT:

Package Downloads
OneToolkit
OneToolkit provides a set of controls, converters and helpers that help you build modern Windows apps. This package provides the core OneToolkit functionality that's independent of any UI framework or app model.

GitHub repositories (10)

Showing the top 5 popular GitHub repositories that depend on Microsoft.Windows.CppWinRT:

Repository Stars
microsoft/PowerToys
Windows system utilities to maximize productivity
microsoft/microsoft-ui-xaml
Windows UI Library: the latest Windows 10 native controls and Fluent styles for your applications
UnigramDev/Unigram
Telegram for Windows 10
dotnet/sdk
Core functionality needed to create .NET Core projects, that is shared between Visual Studio and CLI
microsoft/MixedRealityCompanionKit
This is a MixedRealityToolkit style repository for code bits and components that may not run directly on Microsoft HoloLens or immersive headsets but instead pair with them to build experiences.

Version History

Version Downloads Last updated
2.0.210722.2 710 7/22/2021
2.0.210714.1 510 7/14/2021
2.0.210709.3 382 7/9/2021
2.0.210708.4 1,712 7/8/2021
2.0.210707.1 201 7/7/2021
2.0.210629.4 856 6/30/2021
2.0.210629.2 148 6/29/2021
2.0.210624.2 527 6/24/2021
2.0.210621.3 885 6/21/2021
2.0.210621.2 85 6/21/2021
2.0.210505.3 5,296 5/6/2021
2.0.210504.3 897 5/4/2021
2.0.210503.1 840 5/3/2021
2.0.210427.2 479 4/27/2021
2.0.210403.2 6,773 4/4/2021
2.0.210329.4 990 3/29/2021
2.0.210326.8 332 3/26/2021
2.0.210326.4 144 3/26/2021
2.0.210312.4 67,825 3/12/2021
2.0.210312.3 111 3/12/2021
2.0.210309.3 1,297 3/10/2021
2.0.210304.5 740 3/4/2021
2.0.210304.4 121 3/4/2021
2.0.210301.1 548 3/1/2021
2.0.210225.3 466 2/26/2021
2.0.210211.2 5,569 2/12/2021
2.0.210122.3 5,879 1/23/2021
2.0.201217.4 29,017 12/17/2020
2.0.201215.2 352 12/15/2020
2.0.201201.7 773 12/9/2020
2.0.201113.7 42,210 11/13/2020
2.0.201102.2 7,157 11/2/2020
2.0.201026.4 546 10/26/2020
2.0.201017.1 12,584 10/18/2020
2.0.201008.2 2,013 10/8/2020
2.0.201006.7 529 10/7/2020
2.0.200921.6 15,954 9/21/2020
2.0.200917.4 819 9/18/2020
2.0.200729.8 71,598 7/29/2020
2.0.200728.4 481 7/29/2020
2.0.200703.9 36,878 7/4/2020
2.0.200630.5 8,242 6/30/2020
2.0.200630.4 300 6/30/2020
2.0.200615.7 135,542 6/16/2020
2.0.200609.3 2,177 6/9/2020
2.0.200602.3 5,989 6/2/2020
2.0.200602.2 208 6/2/2020
2.0.200601.2 289 6/1/2020
2.0.200531.2 346 6/1/2020
2.0.200514.2 9,849 5/14/2020
2.0.200512.4 838 5/12/2020
2.0.200511.2 616 5/11/2020
2.0.200508.4 582 5/8/2020
2.0.200316.3 105,153 3/16/2020
2.0.200303.2 1,223 3/5/2020
2.0.200302.1 12,994 3/2/2020
2.0.200224.2 1,666 2/24/2020
2.0.200213.5 253 3/5/2020
2.0.200203.5 13,695 2/3/2020
2.0.200203.3 295 2/3/2020
2.0.200117.5 18,456 1/17/2020
2.0.200116.6 1,130 1/16/2020
2.0.200115.8 612 1/15/2020
2.0.200107.1 983 1/7/2020
2.0.191217.1 6,340 12/18/2019
2.0.191202.6 26,147 12/2/2019
2.0.191202.4 268 12/2/2019
2.0.191202.2 273 12/2/2019
2.0.191111.2 5,334 11/11/2019
2.0.191029.4 1,758 11/7/2019
2.0.191023.3 284 11/7/2019
2.0.191018.6 2,747 10/18/2019
2.0.190730.2 105,840 7/30/2019
2.0.190729.1 377 7/29/2019
2.0.190722.3 4,226 7/22/2019
2.0.190712.2 693 7/12/2019
2.0.190710.3 6,374 7/12/2019
2.0.190620.2 19,665 6/21/2019
2.0.190605.7 21,755 6/6/2019
2.0.190603.8 2,379 6/3/2019
2.0.190603.6 356 6/3/2019
2.0.190603.5 352 6/3/2019
2.0.190603.4 350 6/3/2019
2.0.190530.8 5,457 5/31/2019
2.0.190529.9 36,330 5/29/2019
2.0.190506.1 19,639 5/6/2019
2.0.190425.5 6,590 4/25/2019
2.0.190417.3 60,771 4/17/2019
2.0.190408.1 8,460 4/8/2019
2.0.190405.3 473 4/5/2019
2.0.190404.8 1,723 4/5/2019
2.0.190402.6 689 4/3/2019
2.0.190401.2 394 4/2/2019
2.0.190329.3 456 4/2/2019
1.0.190211.5 10,725 2/11/2019
1.0.190205.2 8,802 2/10/2019
1.0.190128.4 679 2/10/2019
1.0.190111.3 1,050 4/6/2019
1.0.190109.2 12,543 1/9/2019
1.0.181129.3 6,476 11/29/2018
1.0.181115.3 758 11/15/2018
1.0.181108.4 613 11/9/2018
1.0.181002.2 2,356 10/3/2018
1.0.180914.4 685 9/14/2018
1.0.180913.3 611 9/13/2018
Show less