Add support for CsWinRT 3.0 multi-targeting via Windows SDK build number#49721
Closed
Sergio0694 wants to merge 15 commits intodotnet:mainfrom
Closed
Add support for CsWinRT 3.0 multi-targeting via Windows SDK build number#49721Sergio0694 wants to merge 15 commits intodotnet:mainfrom
Sergio0694 wants to merge 15 commits intodotnet:mainfrom
Conversation
Sergio0694
commented
Jul 9, 2025
src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Windows.targets
Show resolved
Hide resolved
099d3b3 to
3299335
Compare
69e72d6 to
4fa6191
Compare
manodasanW
reviewed
Jul 21, 2025
16a6d3f to
76cb47d
Compare
3 tasks
de73c30 to
125c317
Compare
125c317 to
d8d8cb0
Compare
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR enables multi-targeting between CsWinRT 2.x and CsWinRT 3.0 by using the revision number of the Windows SDK version as a discriminator. When the revision number is '.1', the project targets CsWinRT 3.0, while '.0' targets CsWinRT 2.x.
- Adds support for detecting CsWinRT 3.0 usage via revision number parsing
- Implements warning system for preview CsWinRT 3.0 usage
- Defines
CSWINRT3_0preprocessor constant for conditional compilation
Reviewed Changes
Copilot reviewed 22 out of 22 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| Microsoft.NET.TargetFrameworkInference.targets | Adds logic to detect and normalize CsWinRT 3.0 targeting via revision number |
| CreateWindowsSdkKnownFrameworkReferences.cs | Filters framework references based on CsWinRT version selection |
| Microsoft.NET.Sdk.BeforeCommon.targets | Defines CSWINRT3_0 preprocessor constant when targeting CsWinRT 3.0 |
| Microsoft.NET.Windows.targets | Adds warning target for CsWinRT 3.0 preview usage |
| GenerateBundledVersions.targets | Defines supported Windows SDK versions for both CsWinRT 2.x and 3.0 |
| ManualVersions.props | Adds package version properties for CsWinRT 3.0 targeting packs |
| Strings.resx + xlf files | Adds localized warning message for CsWinRT 3.0 preview usage |
| GivenThatWeWantToBuildAWindowsDesktopProject.cs | Adds tests for CsWinRT 3.0 targeting and preprocessor definition |
Contributor
Author
|
Closing this, moved to #50264. |
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.
This PR allows multi-targeting CsWinRT 3.0, by leveraging the build number of the target Windows SDK.
That is, e.g.:
net10.0-windows10.0.22621.0---> CsWinRT 2.xnet10.0-windows10.0.22621.1---> CsWinRT 3.0