-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Add support for CsWinRT 3.0 multi-targeting via Windows SDK build number #49721
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Add support for CsWinRT 3.0 multi-targeting via Windows SDK build number #49721
Conversation
src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Windows.targets
Show resolved
Hide resolved
099d3b3
to
3299335
Compare
69e72d6
to
4fa6191
Compare
16a6d3f
to
76cb47d
Compare
de73c30
to
125c317
Compare
125c317
to
d8d8cb0
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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_0
preprocessor 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 |
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