Repository navigation
Build C++ samples with C++20 to fix STL1011, and map VS 2026 to v145 - #657
Merged
Harini Malothu (HariniMalothu17) merged 3 commits intoAug 11, 2026
Conversation
Abhijeet Jha (iamAbhi-916)
force-pushed
the
user/abhijeetjha/cppwinrt-cpp20-stl1011
branch
5 times, most recently
from
August 11, 2026 06:49
e996d0a to
8590581
Compare
Abhijeet Jha (iamAbhi-916)
marked this pull request as ready for review
August 11, 2026 07:00
|
|
||
| <ItemDefinitionGroup> | ||
| <ClCompile> | ||
| <!-- Microsoft.Windows.CppWinRT.props defaults LanguageStandard to stdcpp17 when a project |
Contributor
There was a problem hiding this comment.
This comment can be removed i think
Contributor
Author
There was a problem hiding this comment.
okay , will clean it up
Contributor
Author
There was a problem hiding this comment.
done
Contributor
Author
|
/azp run |
| <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions> | ||
| <ConformanceMode>true</ConformanceMode> | ||
| <LanguageStandard>stdcpp17</LanguageStandard> | ||
| <LanguageStandard>stdcpp20</LanguageStandard> |
Contributor
There was a problem hiding this comment.
Can you handle for https://github.com/microsoft/WindowsAppSDK-Samples/tree/main/Samples/Islands/UXFrameworksOnIslands as well in this PR?
task.ms/62276972
Contributor
Author
There was a problem hiding this comment.
yeah it would be better to add this too, will update
Contributor
Author
There was a problem hiding this comment.
done
Microsoft.Windows.CppWinRT.props defaults ClCompile.LanguageStandard to stdcpp17 when a project does not set one, and Microsoft.Windows.CppWinRT.targets then adds the deprecated /await switch for stdcpp17. Under /await, winrt/base.h takes the experimental branch and includes <experimental/coroutine>, which now hard-errors: experimental/coroutine(37): error C2338: static assertion failed: 'error STL1011: The /await compiler option, <experimental/coroutine>, ... are deprecated by Microsoft and will be REMOVED SOON.' Set the standard in Samples/Directory.Build.props, which already carries the shared ClCompile item definitions, so it is picked up before the C++/WinRT default applies. The seven projects that set LanguageStandard in their own project body override that, so they are updated individually. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
BuildToolVersion 18 had no AutoDetectedPlatformToolset entry, so PlatformToolset was assigned an empty value and MSBuild fell back to v100: Microsoft.CppBuild.targets(473,5): error MSB8020: The build tools for Visual Studio 2010 (Platform Toolset = 'v100') cannot be found. SampleWidgetProviderApp was the only C++ sample that neither imported Build.Common.Cpp.props nor set its own PlatformToolset, so it imports the shared props now, like the other C++ samples. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The sample relied on unqualified lookup finding members of a dependent base, which current MSVC rejects under two-phase lookup: TextVisual.h(22): error C2061: syntax error: identifier 'ContainerVisual' AutomationFragment.cpp(77): warning C4864: expected 'template' keyword before dependent template name TextVisual<T> derives from D2DSprite<T>, so ContainerVisual, GetVisual, GetBackgroundColor and InvalidateContent are introduced with using-declarations, which also resolves the cascading C2065/C3861/C2672 errors in TextVisual.cpp and in the InsertTextVisual callers. In AutomationFragment::RemoveChild the lambda parameter is dependent, so the member template call needs the template disambiguator. Both are pre-existing conformance gaps, unrelated to the language standard: they reproduce at stdcpp17 with STL1011 suppressed. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Abhijeet Jha (iamAbhi-916)
force-pushed
the
user/abhijeetjha/cppwinrt-cpp20-stl1011
branch
from
August 11, 2026 10:10
a3e1700 to
354a3be
Compare
Godly T.Alias (godlytalias)
approved these changes
Aug 11, 2026
Harini Malothu (HariniMalothu17)
approved these changes
Aug 11, 2026
Harini Malothu (HariniMalothu17)
merged commit Aug 11, 2026
18431c6
into
microsoft:main
1 check passed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Fixes the C++ samples failing to build on current toolsets:
error STL1011from the deprecated/awaitswitch,error MSB8020on Visual Studio 2026, and the template conformance errors inUXFrameworksOnIslands.Fixes ADO 62276972.
Root cause
STL1011 —
Microsoft.Windows.CppWinRT.propsdefaultsClCompile.LanguageStandardtostdcpp17when a project does not set one, andMicrosoft.Windows.CppWinRT.targetsthen adds/awaitforstdcpp17. Under/await,winrt/base.htakes the experimental branch and includes theexperimental/coroutineheader, which now hard-errors. This hits every C++/WinRT sample, whether or not it uses coroutines.MSB8020 —
Build.Common.Cpp.propshas noBuildToolVersionentry for VS 2026, soPlatformToolsetis assigned an empty value and MSBuild falls back tov100.C2061 / C4864 —
UXFrameworksOnIslandsrelies on unqualified lookup finding members of a dependent base, which current MSVC rejects under two-phase lookup.Fix
Set
LanguageStandardtostdcpp20inSamples/Directory.Build.props, and mapBuildToolVersion18 tov145inSamples/Build.Common.Cpp.props.Why 8 files for the language standard:
Directory.Build.propsis imported before the project body, so the 7 projects that set their ownstdcpp17overwrite it — they would still get/awaitand still fail STL1011, so they are updated individually. The other 33 set no value of their own, so they inherit it and need no edit.SampleWidgetProviderAppwas the only C++ sample that neither importedBuild.Common.Cpp.propsnor set its ownPlatformToolset, so it now imports the shared props like the other C++ samples.For
UXFrameworksOnIslands:TextVisual<T>derives fromD2DSprite<T>, soContainerVisual,GetVisual,GetBackgroundColorandInvalidateContentare introduced with using-declarations, which also resolves the cascadingC2065/C3861/C2672errors inTextVisual.cppand in theInsertTextVisualcallers. InAutomationFragment::RemoveChildthe lambda parameter is dependent, so the member template call needs thetemplatedisambiguator. These are pre-existing conformance gaps unrelated to the language standard — they reproduce atstdcpp17with STL1011 suppressed.Validation
Built all 41 C++/WinRT sample solutions at x64 Release on Visual Studio 2026 (MSVC 14.51.36231), before and after the change, with no command-line overrides:
mainRuntime: the rebuilt unpackaged console samples launch without crashing and reach the Windows App SDK bootstrapper. A full functional run was not possible on the validation machine because the matching Windows App Runtime is not installed there.
Target Release
1.8
Checklist
Note that /azp run currently isn't working for this repo.
Builds were run at x64 Release; x86/ARM64 and Debug are unverified. The change is a language-standard switch applied uniformly across all configurations, so it is not configuration-specific.