From 60deec68150e2b5abf13ad29a0fa26d3f9473035 Mon Sep 17 00:00:00 2001 From: Gordon Lam <73506701+yeelam-gordon@users.noreply.github.com> Date: Mon, 8 Dec 2025 09:52:55 +0800 Subject: [PATCH] Using centralized package management for vcxproj (#43920) ## Summary of the Pull Request This pull request updates the build system for several native and managed projects, modernizing NuGet package management and improving code analysis configuration. The main changes involve switching from legacy `packages.config` and manual `.props`/`.targets` imports to PackageReference style for native projects, updating package versions, and streamlining code analysis settings. **Build system modernization and package management:** * Migrated native projects (`PowerToys.MeasureToolCore.vcxproj`, `FindMyMouse.vcxproj`) from legacy `packages.config` and manual `.props`/`.targets` imports to NuGet PackageReference style, simplifying dependency management and build configuration. This includes removing the `packages.config` file and related import/error logic, and introducing `PackageReference` items for required packages. [[1]](diffhunk://#diff-76320b3a74a9241df46edb536ba0f817d7150ddf76bb0fe677e2b276f8bae95aL3-R18) [[2]](diffhunk://#diff-76320b3a74a9241df46edb536ba0f817d7150ddf76bb0fe677e2b276f8bae95aR41-L41) [[3]](diffhunk://#diff-76320b3a74a9241df46edb536ba0f817d7150ddf76bb0fe677e2b276f8bae95aL145-R153) [[4]](diffhunk://#diff-d3a7d80ebbca915b42727633451e769ed2306b418ef3d82b3b04fd5f79560f17L1-L17) [[5]](diffhunk://#diff-0f27869c4e90c8fd2c81f5688c58da99afcc9e5767e69ef7938265dbb6928e0fL3-R13) * Updated the centralized package versions in `Directory.Packages.props`, adding new entries for `boost`, `boost_regex-vc143`, `Microsoft.Windows.ImplementationLibrary`, and `Microsoft.WindowsAppSDK.Foundation` to support the new build system and dependencies. [[1]](diffhunk://#diff-5baf5f9e448ad54ab25a091adee0da05d4d228481c9200518fcb1b53a65d4156R10-R11) [[2]](diffhunk://#diff-5baf5f9e448ad54ab25a091adee0da05d4d228481c9200518fcb1b53a65d4156R74-R77) **Code analysis improvements:** * Added configuration to both native and managed projects (`PowerToys.MeasureToolCore.vcxproj`, `MeasureToolUI.csproj`) to suppress specific warnings (81010002) and exclude NuGet cache files from code analysis, reducing noise and improving build performance. [[1]](diffhunk://#diff-76320b3a74a9241df46edb536ba0f817d7150ddf76bb0fe677e2b276f8bae95aL3-R18) [[2]](diffhunk://#diff-4f2b49a1a5cc7da36ee6d5044792ef681fd0ea5bea12db9ebd4c3090680d4b07R6-R11) **Project reference and output handling:** * Updated the managed project (`MeasureToolUI.csproj`) to handle native project outputs more robustly, ensuring the WinMD and DLL files are available at runtime and configuring the project reference to avoid assembly reference issues. **Compiler configuration:** * Enhanced C++ compiler settings in `Cpp.Build.props` to treat angle-bracket includes as external, disable warnings and analysis for external headers, and optimize build performance. --- Cpp.Build.props | 11 ++- Directory.Packages.props | 4 + .../PowerToys.MeasureToolCore.vcxproj | 68 ++++----------- .../MeasureToolCore/packages.config | 17 ---- .../MeasureToolUI/MeasureToolUI.csproj | 9 +- .../FindMyMouse/FindMyMouse.vcxproj | 82 ++++++------------- .../MouseUtils/FindMyMouse/packages.config | 12 --- src/modules/cmdpal/CoreCommonProps.props | 6 +- .../Microsoft.CmdPal.UI/CmdPal.Branding.props | 14 ++-- .../Microsoft.CmdPal.UI/CmdPal.pre.props | 2 +- .../Microsoft.CmdPal.UI.csproj | 27 +++--- .../FontIconGlyphClassifier.cpp | 6 +- .../Microsoft.Terminal.UI.vcxproj | 72 +++++----------- .../Microsoft.Terminal.UI/packages.config | 17 ---- .../PowerRenameUILib/PowerRenameUI.vcxproj | 81 +++++------------- src/runner/packages.config | 16 ---- src/runner/runner.vcxproj | 74 ++++++----------- 17 files changed, 159 insertions(+), 359 deletions(-) delete mode 100644 src/modules/MeasureTool/MeasureToolCore/packages.config delete mode 100644 src/modules/MouseUtils/FindMyMouse/packages.config delete mode 100644 src/modules/cmdpal/Microsoft.Terminal.UI/packages.config delete mode 100644 src/runner/packages.config diff --git a/Cpp.Build.props b/Cpp.Build.props index f146a4d770..7b988f0d6f 100644 --- a/Cpp.Build.props +++ b/Cpp.Build.props @@ -42,6 +42,11 @@ + + true + TurnOffAllWarnings + true + true Use pch.h @@ -111,13 +116,11 @@ - + true true - + false true false diff --git a/Directory.Packages.props b/Directory.Packages.props index 6744b991aa..00db38f4df 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -7,6 +7,8 @@ + + @@ -69,8 +71,10 @@ This is present due to a bug in CsWinRT where WPF projects cause the analyzer to fail. --> + + diff --git a/src/modules/MeasureTool/MeasureToolCore/PowerToys.MeasureToolCore.vcxproj b/src/modules/MeasureTool/MeasureToolCore/PowerToys.MeasureToolCore.vcxproj index 6de7c50b55..c71c81acec 100644 --- a/src/modules/MeasureTool/MeasureToolCore/PowerToys.MeasureToolCore.vcxproj +++ b/src/modules/MeasureTool/MeasureToolCore/PowerToys.MeasureToolCore.vcxproj @@ -1,14 +1,16 @@  - - - - - - - - - + + + PackageReference + + + native,Version=v0.0 + + + Windows + $(WindowsTargetPlatformVersion) + true true @@ -31,6 +33,11 @@ true true + + + + + DynamicLibrary @@ -38,7 +45,6 @@ true - @@ -118,9 +124,6 @@ true - - - {caba8dfb-823b-4bf2-93ac-3f31984150d9} @@ -142,42 +145,5 @@ - - - - - - - - - - - - - - - - This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. - - - - - - - - - - - - - - - - - - - - - - + \ No newline at end of file diff --git a/src/modules/MeasureTool/MeasureToolCore/packages.config b/src/modules/MeasureTool/MeasureToolCore/packages.config deleted file mode 100644 index 6416ca5b16..0000000000 --- a/src/modules/MeasureTool/MeasureToolCore/packages.config +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/modules/MeasureTool/MeasureToolUI/MeasureToolUI.csproj b/src/modules/MeasureTool/MeasureToolUI/MeasureToolUI.csproj index 434ff088b2..3e92bd42f3 100644 --- a/src/modules/MeasureTool/MeasureToolUI/MeasureToolUI.csproj +++ b/src/modules/MeasureTool/MeasureToolUI/MeasureToolUI.csproj @@ -73,6 +73,13 @@ - + + false + true + + + + PreserveNewest + diff --git a/src/modules/MouseUtils/FindMyMouse/FindMyMouse.vcxproj b/src/modules/MouseUtils/FindMyMouse/FindMyMouse.vcxproj index d127de245e..bfed4af15d 100644 --- a/src/modules/MouseUtils/FindMyMouse/FindMyMouse.vcxproj +++ b/src/modules/MouseUtils/FindMyMouse/FindMyMouse.vcxproj @@ -1,13 +1,16 @@ - - - - - - - - + + + PackageReference + + + native,Version=v0.0 + + + Windows + $(WindowsTargetPlatformVersion) + 15.0 {e94fd11c-0591-456f-899f-efc0ca548336} @@ -20,9 +23,12 @@ false true false - - packages.config + + + + + DynamicLibrary @@ -127,18 +133,18 @@ - - - - - - - - - NotUsing - - + + + + + + + + NotUsing + + + <_ToDelete Include="$(OutDir)Microsoft.Web.WebView2.Core.dll" /> @@ -148,38 +154,4 @@ - - - - - - - - - - - - - - - This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/modules/MouseUtils/FindMyMouse/packages.config b/src/modules/MouseUtils/FindMyMouse/packages.config deleted file mode 100644 index cff3aa8705..0000000000 --- a/src/modules/MouseUtils/FindMyMouse/packages.config +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - - - - - diff --git a/src/modules/cmdpal/CoreCommonProps.props b/src/modules/cmdpal/CoreCommonProps.props index aa091d435e..438d044e2a 100644 --- a/src/modules/cmdpal/CoreCommonProps.props +++ b/src/modules/cmdpal/CoreCommonProps.props @@ -6,12 +6,12 @@ preview - $(SolutionDir)$(Platform)\$(Configuration)\WinUI3Apps\CmdPal\ + ..\..\..\$(Platform)\$(Configuration)\WinUI3Apps\CmdPal\ false false $(RootNamespace).pri - + SA1313; @@ -42,5 +42,5 @@ Resources.Designer.cs - + diff --git a/src/modules/cmdpal/Microsoft.CmdPal.UI/CmdPal.Branding.props b/src/modules/cmdpal/Microsoft.CmdPal.UI/CmdPal.Branding.props index d99688c081..298bcbd787 100644 --- a/src/modules/cmdpal/Microsoft.CmdPal.UI/CmdPal.Branding.props +++ b/src/modules/cmdpal/Microsoft.CmdPal.UI/CmdPal.Branding.props @@ -24,7 +24,7 @@ - + true Assets\%(RecursiveDir)%(FileName)%(Extension) @@ -35,14 +35,10 @@ - - - - + + + + diff --git a/src/modules/cmdpal/Microsoft.CmdPal.UI/CmdPal.pre.props b/src/modules/cmdpal/Microsoft.CmdPal.UI/CmdPal.pre.props index 21c2e7d8d1..d65b4a2cc2 100644 --- a/src/modules/cmdpal/Microsoft.CmdPal.UI/CmdPal.pre.props +++ b/src/modules/cmdpal/Microsoft.CmdPal.UI/CmdPal.pre.props @@ -7,7 +7,7 @@ - $(SolutionDir)$(Platform)\$(Configuration)\WinUI3Apps\CmdPal + ..\..\..\..\$(Platform)\$(Configuration)\WinUI3Apps\CmdPal $(OutputPath)\AppPackages\ diff --git a/src/modules/cmdpal/Microsoft.CmdPal.UI/Microsoft.CmdPal.UI.csproj b/src/modules/cmdpal/Microsoft.CmdPal.UI/Microsoft.CmdPal.UI.csproj index eac3643847..8397ffc767 100644 --- a/src/modules/cmdpal/Microsoft.CmdPal.UI/Microsoft.CmdPal.UI.csproj +++ b/src/modules/cmdpal/Microsoft.CmdPal.UI/Microsoft.CmdPal.UI.csproj @@ -15,7 +15,7 @@ enable enable true - preview + preview $(CmdPalVersion) @@ -23,13 +23,14 @@ false false + true - + - + --> true @@ -45,7 +46,7 @@ - + Microsoft.Terminal.UI;CmdPalKeyboardService $(OutDir) @@ -95,7 +96,7 @@ - + all runtime; build; native; contentfiles; analyzers @@ -141,12 +142,16 @@ - - True - True - True + + False + True - + + + + + PreserveNewest + True True diff --git a/src/modules/cmdpal/Microsoft.Terminal.UI/FontIconGlyphClassifier.cpp b/src/modules/cmdpal/Microsoft.Terminal.UI/FontIconGlyphClassifier.cpp index bc3496a542..e6cb46457b 100644 --- a/src/modules/cmdpal/Microsoft.Terminal.UI/FontIconGlyphClassifier.cpp +++ b/src/modules/cmdpal/Microsoft.Terminal.UI/FontIconGlyphClassifier.cpp @@ -12,9 +12,9 @@ namespace winrt::Microsoft::Terminal::UI::implementation // Check if the code point is in the Private Use Area range used by Fluent UI icons. [[nodiscard]] constexpr bool _isFluentIconPua(const UChar32 cp) noexcept { - static constexpr UChar32 _fluentIconsPrivateUseAreaStart = 0xE700; - static constexpr UChar32 _fluentIconsPrivateUseAreaEnd = 0xF8FF; - return cp >= _fluentIconsPrivateUseAreaStart && cp <= _fluentIconsPrivateUseAreaEnd; + constexpr UChar32 fluentIconsPrivateUseAreaStart = 0xE700; + constexpr UChar32 fluentIconsPrivateUseAreaEnd = 0xF8FF; + return cp >= fluentIconsPrivateUseAreaStart && cp <= fluentIconsPrivateUseAreaEnd; } // Determine if the given text (as a sequence of UChar code units) is emoji diff --git a/src/modules/cmdpal/Microsoft.Terminal.UI/Microsoft.Terminal.UI.vcxproj b/src/modules/cmdpal/Microsoft.Terminal.UI/Microsoft.Terminal.UI.vcxproj index 6e474cf5f3..676d7297ba 100644 --- a/src/modules/cmdpal/Microsoft.Terminal.UI/Microsoft.Terminal.UI.vcxproj +++ b/src/modules/cmdpal/Microsoft.Terminal.UI/Microsoft.Terminal.UI.vcxproj @@ -1,17 +1,16 @@  - - - ..\..\..\..\ - $(PathToRoot)packages\Microsoft.WindowsAppSDK.1.8.250907003 + + + PackageReference + + native,Version=v0.0 + + Windows + $(WindowsTargetPlatformVersion) + + - - - - - - - true true @@ -28,6 +27,11 @@ 10.0.26100.0 10.0.19041.0 + + + + + @@ -47,10 +51,6 @@ x64 - - $(SolutionDir)$(Platform)\$(Configuration)\WinUI3Apps\CmdPal - obj\$(Platform)\$(Configuration)\ - DynamicLibrary v143 @@ -200,43 +200,11 @@ - + + ..\..\..\..\$(Platform)\$(Configuration)\WinUI3Apps\CmdPal + obj\$(Platform)\$(Configuration)\ + - - - - - - - - - - - - - - - This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. - - - - - - - - - - - - - - - - - - - - - + \ No newline at end of file diff --git a/src/modules/cmdpal/Microsoft.Terminal.UI/packages.config b/src/modules/cmdpal/Microsoft.Terminal.UI/packages.config deleted file mode 100644 index 2fb34c8fed..0000000000 --- a/src/modules/cmdpal/Microsoft.Terminal.UI/packages.config +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/modules/powerrename/PowerRenameUILib/PowerRenameUI.vcxproj b/src/modules/powerrename/PowerRenameUILib/PowerRenameUI.vcxproj index eb21a94049..7f19db44b8 100644 --- a/src/modules/powerrename/PowerRenameUILib/PowerRenameUI.vcxproj +++ b/src/modules/powerrename/PowerRenameUILib/PowerRenameUI.vcxproj @@ -1,18 +1,16 @@  - - - - - - - - - - - - - + + + PackageReference + + + native,Version=v0.0 + + + Windows + $(WindowsTargetPlatformVersion) + true true @@ -37,9 +35,16 @@ true PowerToys.PowerRename.pri + win10-x64;win10-arm64 + + + + + + + - Application v143 @@ -212,54 +217,10 @@ - - - - - - - - - - - - - - - - - - - This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. - - - - - - - - - - - - - - - - - - - - - - - - - - + - \ No newline at end of file + diff --git a/src/runner/packages.config b/src/runner/packages.config deleted file mode 100644 index 74d5ef5747..0000000000 --- a/src/runner/packages.config +++ /dev/null @@ -1,16 +0,0 @@ - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/runner/runner.vcxproj b/src/runner/runner.vcxproj index 1eae5a3573..35a68e220f 100644 --- a/src/runner/runner.vcxproj +++ b/src/runner/runner.vcxproj @@ -1,27 +1,34 @@  - + 81010002 + + + PackageReference + + native,Version=v0.0 + + Windows + $(WindowsTargetPlatformVersion) + 15.0 {9412D5C6-2CF2-4FC2-A601-B55508EA9B27} powertoys runner + + + + + + - - - - - - - - Application @@ -31,10 +38,6 @@ true - - - - @@ -140,39 +143,16 @@ - - - - - - - - - - - - - - - This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. - - - - - - - - - - - - - - - - - - - + + + + + + + + + NotUsing + + \ No newline at end of file