-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Add 'RunCsWinRTGenerator' task and target #49417
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 'RunCsWinRTGenerator' task and target #49417
Conversation
src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Windows.targets
Outdated
Show resolved
Hide resolved
src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Windows.targets
Show resolved
Hide resolved
src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Windows.targets
Show resolved
Hide resolved
src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Windows.targets
Outdated
Show resolved
Hide resolved
8931b3e
to
b9d1b7a
Compare
50992cc
to
e520c9e
Compare
Also fix incrementality for 'cswinrtgen'
e40a0c5
to
3e38237
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 adds infrastructure for CsWinRT 3.0 support by introducing a new MSBuild task and target for running the cswinrtgen
tool. The feature is opt-in and disabled by default to support the preview nature of CsWinRT 3.0.
Key Changes:
- Added
RunCsWinRTGenerator
MSBuild task that wraps thecswinrtgen
tool execution - Created
_RunCsWinRTGenerator
target with incremental build support and proper dependency management - Implemented automatic tool path resolution based on the
WinRT.Runtime.dll
assembly location
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
File | Description |
---|---|
src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Windows.targets | Adds MSBuild targets and properties for CsWinRT generator integration with incremental build support |
src/Tasks/Microsoft.NET.Build.Tasks/RunCsWinRTGenerator.cs | Implements the MSBuild task that invokes the cswinrtgen tool with comprehensive parameter validation |
Comments suppressed due to low confidence (1)
src/Tasks/Microsoft.NET.Build.Tasks/RunCsWinRTGenerator.cs:109
- NET10_0_OR_GREATER is not a valid .NET target framework version. The highest released version as of my knowledge cutoff is .NET 8.0. Consider using NET8_0_OR_GREATER or remove this conditional compilation if it's intended for future versions.
#if NET10_0_OR_GREATER
src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Windows.targets
Show resolved
Hide resolved
} | ||
|
||
if (CsWinRTToolsArchitecture is not null && | ||
!CsWinRTToolsArchitecture.Equals("x86", StringComparison.OrdinalIgnoreCase) && |
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.
[nitpick] The architecture validation logic could be simplified using a collection-based approach. Consider using a HashSet or array with Contains() for better maintainability.
Copilot uses AI. Check for mistakes.
This PR adds supporting infra for CsWinRT 3.0 (see here):
RunCsWinRTGenerator
task that runscswinrtgen
Everything is opt-in and off-by-default.