Microsoft.Windows.CppWinRT
2.0.190506.1
Prefix Reserved
See the version list below for details.
Requires NuGet 2.5 or higher.
dotnet add package Microsoft.Windows.CppWinRT --version 2.0.190506.1
NuGet\Install-Package Microsoft.Windows.CppWinRT -Version 2.0.190506.1
<PackageReference Include="Microsoft.Windows.CppWinRT" Version="2.0.190506.1" />
paket add Microsoft.Windows.CppWinRT --version 2.0.190506.1
#r "nuget: Microsoft.Windows.CppWinRT, 2.0.190506.1"
// Install Microsoft.Windows.CppWinRT as a Cake Addin #addin nuget:?package=Microsoft.Windows.CppWinRT&version=2.0.190506.1 // Install Microsoft.Windows.CppWinRT as a Cake Tool #tool nuget:?package=Microsoft.Windows.CppWinRT&version=2.0.190506.1
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.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
native | native is compatible. |
This package has no dependencies.
NuGet packages (2)
Showing the top 2 NuGet packages that depend on Microsoft.Windows.CppWinRT:
Package | Downloads |
---|---|
Unpackaged
Helpers for unpackaged and XAML Islands apps |
|
WinUIEssential.WinUI3
Essential helpers for developing WinUI(UWP) |
GitHub repositories (24)
Showing the top 5 popular GitHub repositories that depend on Microsoft.Windows.CppWinRT:
Repository | Stars |
---|---|
microsoft/PowerToys
Windows system utilities to maximize productivity
|
|
files-community/Files
A modern file manager that helps users organize their files and folders.
|
|
mono/SkiaSharp
SkiaSharp is a cross-platform 2D graphics API for .NET platforms based on Google's Skia Graphics Library. It provides a comprehensive 2D API that can be used across mobile, server and desktop models to render images.
|
|
UnigramDev/Unigram
Telegram for Windows
|
|
microsoft/devhome
The new Dev Home experience for Windows!
|
Version | Downloads | Last updated |
---|---|---|
2.0.240405.15 | 63,353 | 4/5/2024 |
2.0.240111.5 | 67,265 | 1/12/2024 |
2.0.230706.1 | 233,772 | 7/6/2023 |
2.0.230524.4 | 10,454 | 5/25/2023 |
2.0.230524.3 | 2,306 | 5/24/2023 |
2.0.230225.1 | 120,437 | 2/25/2023 |
2.0.230207.1 | 200,925 | 2/7/2023 |
2.0.221121.5 | 168,666 | 11/21/2022 |
2.0.221117.1 | 12,983 | 11/17/2022 |
2.0.221104.6 | 119,768 | 11/4/2022 |
2.0.221101.3 | 3,096 | 11/1/2022 |
2.0.220929.3 | 48,400 | 9/29/2022 |
2.0.220912.1 | 27,092 | 9/12/2022 |
2.0.220909.4 | 2,265 | 9/12/2022 |
2.0.220608.4 | 88,263 | 6/8/2022 |
2.0.220607.4 | 4,569 | 6/8/2022 |
2.0.220531.1 | 100,161 | 6/1/2022 |
2.0.220418.1 | 218,400 | 4/18/2022 |
2.0.220331.4 | 38,972 | 3/31/2022 |
2.0.220325.3 | 172,670 | 3/25/2022 |
2.0.220315.1 | 3,196 | 3/15/2022 |
2.0.220224.4 | 10,055 | 2/25/2022 |
2.0.220131.2 | 157,907 | 1/31/2022 |
2.0.220110.5 | 73,116 | 1/10/2022 |
2.0.220110.4 | 2,297 | 1/10/2022 |
2.0.220110.3 | 2,258 | 1/10/2022 |
2.0.211028.7 | 520,166 | 10/29/2021 |
2.0.210930.14 | 24,992 | 10/1/2021 |
2.0.210930.8 | 1,895 | 9/30/2021 |
2.0.210922.5 | 36,458 | 9/22/2021 |
2.0.210913.7 | 22,711 | 9/13/2021 |
2.0.210825.3 | 6,530 | 8/25/2021 |
2.0.210806.1 | 302,161 | 8/6/2021 |
2.0.210722.2 | 22,091 | 7/22/2021 |
2.0.210714.1 | 9,418 | 7/14/2021 |
2.0.210709.3 | 3,906 | 7/9/2021 |
2.0.210708.4 | 4,466 | 7/8/2021 |
2.0.210707.1 | 2,329 | 7/7/2021 |
2.0.210629.4 | 4,638 | 6/30/2021 |
2.0.210629.2 | 2,161 | 6/29/2021 |
2.0.210624.2 | 3,102 | 6/24/2021 |
2.0.210621.3 | 19,802 | 6/21/2021 |
2.0.210621.2 | 2,064 | 6/21/2021 |
2.0.210505.3 | 48,983 | 5/6/2021 |
2.0.210504.3 | 32,193 | 5/4/2021 |
2.0.210503.1 | 10,939 | 5/3/2021 |
2.0.210427.2 | 5,215 | 4/27/2021 |
2.0.210403.2 | 17,277 | 4/4/2021 |
2.0.210329.4 | 3,812 | 3/29/2021 |
2.0.210326.8 | 2,157 | 3/26/2021 |
2.0.210326.4 | 2,020 | 3/26/2021 |
2.0.210312.4 | 417,547 | 3/12/2021 |
2.0.210312.3 | 1,979 | 3/12/2021 |
2.0.210309.3 | 34,685 | 3/10/2021 |
2.0.210304.5 | 2,464 | 3/4/2021 |
2.0.210304.4 | 2,029 | 3/4/2021 |
2.0.210301.1 | 5,310 | 3/1/2021 |
2.0.210225.3 | 2,975 | 2/26/2021 |
2.0.210211.2 | 17,176 | 2/12/2021 |
2.0.210122.3 | 9,553 | 1/23/2021 |
2.0.201217.4 | 52,199 | 12/17/2020 |
2.0.201215.2 | 1,887 | 12/15/2020 |
2.0.201201.7 | 387,205 | 12/9/2020 |
2.0.201113.7 | 168,213 | 11/13/2020 |
2.0.201102.2 | 60,228 | 11/2/2020 |
2.0.201026.4 | 2,336 | 10/26/2020 |
2.0.201017.1 | 38,531 | 10/18/2020 |
2.0.201008.2 | 4,584 | 10/8/2020 |
2.0.201006.7 | 2,341 | 10/7/2020 |
2.0.200921.6 | 85,947 | 9/21/2020 |
2.0.200917.4 | 3,888 | 9/18/2020 |
2.0.200729.8 | 152,399 | 7/29/2020 |
2.0.200728.4 | 2,418 | 7/29/2020 |
2.0.200703.9 | 157,501 | 7/4/2020 |
2.0.200630.5 | 10,617 | 6/30/2020 |
2.0.200630.4 | 2,198 | 6/30/2020 |
2.0.200615.7 | 234,558 | 6/16/2020 |
2.0.200609.3 | 4,578 | 6/9/2020 |
2.0.200602.3 | 8,598 | 6/2/2020 |
2.0.200602.2 | 2,060 | 6/2/2020 |
2.0.200601.2 | 2,034 | 6/1/2020 |
2.0.200531.2 | 2,187 | 6/1/2020 |
2.0.200514.2 | 14,802 | 5/14/2020 |
2.0.200512.4 | 2,552 | 5/12/2020 |
2.0.200511.2 | 2,648 | 5/11/2020 |
2.0.200508.4 | 2,355 | 5/8/2020 |
2.0.200316.3 | 262,148 | 3/16/2020 |
2.0.200303.2 | 3,326 | 3/5/2020 |
2.0.200302.1 | 35,233 | 3/2/2020 |
2.0.200224.2 | 3,450 | 2/24/2020 |
2.0.200213.5 | 1,858 | 3/5/2020 |
2.0.200203.5 | 19,695 | 2/3/2020 |
2.0.200203.3 | 2,002 | 2/3/2020 |
2.0.200117.5 | 54,420 | 1/17/2020 |
2.0.200116.6 | 2,993 | 1/16/2020 |
2.0.200115.8 | 2,564 | 1/15/2020 |
2.0.200107.1 | 2,946 | 1/7/2020 |
2.0.191217.1 | 8,488 | 12/18/2019 |
2.0.191202.6 | 62,241 | 12/2/2019 |
2.0.191202.4 | 2,255 | 12/2/2019 |
2.0.191202.2 | 2,015 | 12/2/2019 |
2.0.191111.2 | 19,617 | 11/11/2019 |
2.0.191029.4 | 3,652 | 11/7/2019 |
2.0.191023.3 | 2,092 | 11/7/2019 |
2.0.191018.6 | 4,709 | 10/18/2019 |
2.0.190730.2 | 144,411 | 7/30/2019 |
2.0.190729.1 | 2,264 | 7/29/2019 |
2.0.190722.3 | 6,125 | 7/22/2019 |
2.0.190712.2 | 2,498 | 7/12/2019 |
2.0.190710.3 | 8,186 | 7/12/2019 |
2.0.190620.2 | 23,737 | 6/21/2019 |
2.0.190605.7 | 25,006 | 6/6/2019 |
2.0.190603.8 | 4,672 | 6/3/2019 |
2.0.190603.6 | 2,412 | 6/3/2019 |
2.0.190603.5 | 2,210 | 6/3/2019 |
2.0.190603.4 | 2,591 | 6/3/2019 |
2.0.190530.8 | 7,445 | 5/31/2019 |
2.0.190529.9 | 39,738 | 5/29/2019 |
2.0.190506.1 | 28,947 | 5/6/2019 |
2.0.190425.5 | 8,737 | 4/25/2019 |
2.0.190417.3 | 63,333 | 4/17/2019 |
2.0.190408.1 | 12,265 | 4/8/2019 |
2.0.190405.3 | 2,481 | 4/5/2019 |
2.0.190404.8 | 4,788 | 4/5/2019 |
2.0.190402.6 | 3,053 | 4/3/2019 |
2.0.190401.2 | 2,591 | 4/2/2019 |
2.0.190329.3 | 2,661 | 4/2/2019 |
1.0.190211.5 | 13,529 | 2/11/2019 |
1.0.190205.2 | 12,047 | 2/10/2019 |
1.0.190128.4 | 2,765 | 2/10/2019 |
1.0.190111.3 | 3,331 | 4/6/2019 |
1.0.190109.2 | 15,301 | 1/9/2019 |
1.0.181129.3 | 9,485 | 11/29/2018 |
1.0.181115.3 | 3,044 | 11/15/2018 |
1.0.181108.4 | 2,938 | 11/9/2018 |
1.0.181002.2 | 4,918 | 10/3/2018 |
1.0.180914.4 | 3,057 | 9/14/2018 |
1.0.180913.3 | 3,579 | 9/13/2018 |