Skip to content

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

Open
wants to merge 13 commits into
base: main
Choose a base branch
from

Conversation

Sergio0694
Copy link
Contributor

@Sergio0694 Sergio0694 commented Jul 9, 2025

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.x
  • net10.0-windows10.0.22621.1 ---> CsWinRT 3.0

@Copilot Copilot AI review requested due to automatic review settings August 8, 2025 19:42
@Sergio0694 Sergio0694 force-pushed the user/sergiopedri/cswinrt3-multi-targeting branch from 125c317 to d8d8cb0 Compare August 8, 2025 19:42
Copy link
Contributor

@Copilot Copilot AI left a 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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants