Skip to content

[Build] Separate WinRT props from common .NET props, make verify script more robust and faster#48059

Open
daverayment wants to merge 2 commits into
microsoft:mainfrom
daverayment:feat/separate-cswinrt-props
Open

[Build] Separate WinRT props from common .NET props, make verify script more robust and faster#48059
daverayment wants to merge 2 commits into
microsoft:mainfrom
daverayment:feat/separate-cswinrt-props

Conversation

@daverayment
Copy link
Copy Markdown
Collaborator

Summary of the Pull Request

Separates out the common .NET build properties from Common.Dotnet.CsWinRT.props into a new file so POCO libraries don't have to import WinRT or add exclusions to verifyCommonProps.ps1. Also updates the verify script for robustness and speed.

PR Checklist

  • Closes: #xxx
  • Communication: I've discussed this with core contributors already. If the work hasn't been agreed, this work might be rejected
  • Tests: Added/updated and all pass
  • Localization: All end-user-facing strings can be localized
  • Dev docs: Added/updated
  • New binaries: Added on the required places
  • Documentation updated: If checked, please file a pull request on our docs repo and link it here: #xxx

Detailed Description of the Pull Request / Additional comments

This is a follow-on from #47211, which included a C# project that didn't target WinRT. Previously, all C# projects were mandated to include Common.Dotnet.CsWinRT.props, even if they didn't need the WinRT import, because the common .NET build properties like TargetFramework and Debug/Release configuration were included in the same file.

This PR separates out the non-WinRT information into a new Common.Dotnet.props file. The existing Common.Dotnet.CsWinRT.props file imports this, meaning no changes are required for existing C# projects.

Additionally, the verifyCommonProps.ps1 script has been updated to remove redundant exclusions, add checks for malformed XML, and to speed up the scan.

Changes to verifyCommonProps.ps1

The following updates were made:

  • Added descriptive header and param info.
  • Now using .NET's EnumerateFiles() instead of Powershell's slow file enumeration.
  • Now using XmlDocument.Load() to quickly load the content of the file.
  • Parsing the document now uses GetElementsByTagName() with a '*' wildcard for the namespace to pull out Import tags regardless of location or ns prefix.
  • Removed prior exclusions for Microsoft.CmdPal.Core.* and Microsoft.CmdPal.Ext.Shell projects. There are no Core projects any longer and the Microsoft.CmdPal.Ext.Shell project already includes an import for Common.Dotnet.CsWinRT.props.
  • Filename comparisons now use an exact match to the filename itself rather than a wildcard substring match. This means the check is robust against project names with the same suffix.
  • Early exit break on successful match, so the whole file need not be scanned.
  • try/catch added to prevent a .csproj XML parsing error from breaking the CI.

Validation Steps Performed

  • Built all Quick Accent projects and confirmed all unit tests passed.
  • Edited a .csproj to exclude the end tag. Ran verifyCommonProps.ps1 to confirm the parsing error was reported.
  • Edited verifyCommonProps.ps1 to remove the exclusion for TemplateCmdPalExtension.csproj. Ran the script to confirm that the file was correctly flagged.
  • Edited PowerAccent.Common.csproj to remove the Import for Common.Dotnet.props. Ran the verify script to confirm that the file was correctly flagged.
  • Edited PowerAccent.Core.csproj to remove the Import for Common.Dotnet.CsWinRT.props. Ran the verify script to confirm that the file was correctly flagged.

Verify Script Performance

File cache Before (ms) After (ms)
Cold 3123 1739
Warm 1849 686

… from Common.Dotnet.CsWinRT.props into it. Rewrite verifyCommonProps.ps1 to be faster and more robust. Remove previous exclusion for PowerAccent.Common and remove hard-coded TargetFramework from the same project.
@daverayment daverayment requested a review from a team as a code owner May 22, 2026 18:39
@daverayment daverayment added the Area-Build Issues pertaining to the build system, CI, infrastructure, meta label May 22, 2026
@daverayment daverayment requested a review from snickler May 22, 2026 18:39
Comment thread .pipelines/verifyCommonProps.ps1 Fixed
@github-actions

This comment has been minimized.

@github-actions
Copy link
Copy Markdown

@check-spelling-bot Report

🔴 Please review

See the 📂 files view, the 📜action log, 👼 SARIF report, or 📝 job summary for details.

Unrecognized words (4)

DWRITE
LWIN
VCENTER
VREDRAW

These words are not needed and should be removed ABlocked AClient AColumn ACR ADate ADifferent AHybrid ALarger AModifier ANull AOklab APeriod ARandom ARemapped ASingle ASUS bck BNumber BOklab BVal BValue CAtl CCom CContext CDeclaration CElems Chunghwa CImage CMock CPower CSearch CSettings CSOT CStyle CTest CVal CVirtual DArchitectures DComposition defaulttonearest diu DSVG dwrite EAccess EFile EInvalid ENot EProvider ESettings eurochange FErase FInc FMask FNumber FRestore GNumber GValue Hann HHmmssfff Hostx HPhysical HSpeed HSync HVal HValue HWP IPREVIEW ITHUMBNAIL IVO kdc LExit LPCFHOOKPROC LPrivate LReader LUMA LVal lwin MMdd MRT MSHCTX MSHLFLAGS Nanjing newcolor NLog oldcolor outsourced PBlob PElems PHL pinboard PStr PToy QDS RAlt RAquadrant rectp RKey RNumber scanled suntimes Tianma UBreak UCallback UError UFlags UHash UMax UMin unsubscribes UOffset UType vcenter VDesktop vredraw VSpeed VSync WBounds WClass workerw WReserved XAxis XButton XDeployment XDimension XDocument XElement XFile XIncrement XLoc XNamespace XPels XPixel XPos XResource XSpeed XStr XTimer YAxis YDimension YIncrement YPels YPos YResolution YSpeed YStr YTimer

To accept these unrecognized words as correct and remove the previously acknowledged and now absent words, you could run the following commands

... in a clone of the git@github.com:daverayment/PowerToys.git repository
on the feat/separate-cswinrt-props branch (ℹ️ how do I use this?):

curl -s -S -L 'https://raw.githubusercontent.com/check-spelling/check-spelling/cfb6f7e75bbfc89c71eaa30366d0c166f1bd9c8c/apply.pl' |
perl - 'https://github.com/microsoft/PowerToys/actions/runs/26306950766/attempts/1' &&
git commit -m 'Update check-spelling metadata'
If the flagged items are 🤯 false positives

If items relate to a ...

  • binary file (or some other file you wouldn't want to check at all).

    Please add a file path to the excludes.txt file matching the containing file.

    File paths are Perl 5 Regular Expressions - you can test yours before committing to verify it will match your files.

    ^ refers to the file's path from the root of the repository, so ^README\.md$ would exclude README.md (on whichever branch you're using).

  • well-formed pattern.

    If you can write a pattern that would match it,
    try adding it to the patterns.txt file.

    Patterns are Perl 5 Regular Expressions - you can test yours before committing to verify it will match your lines.

    Note that patterns can't match multiline strings.

Copy link
Copy Markdown
Collaborator

@snickler snickler left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

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

Labels

Area-Build Issues pertaining to the build system, CI, infrastructure, meta

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants