2026-02-06 16:12:44 -08:00
<?xml version="1.0" encoding="utf-8"?>
2022-05-11 13:35:18 +03:00
<Project DefaultTargets= "Build" ToolsVersion= "15.0" xmlns= "http://schemas.microsoft.com/developer/msbuild/2003" >
2026-02-06 16:12:44 -08:00
<Import Project= "$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<Import Project= "$(RepoRoot)packages\Microsoft.Windows.CppWinRT.2.0.240111.5\build\native\Microsoft.Windows.CppWinRT.props" Condition= "Exists('$(RepoRoot)packages\Microsoft.Windows.CppWinRT.2.0.240111.5\build\native\Microsoft.Windows.CppWinRT.props')" />
2022-05-11 13:35:18 +03:00
<Target Name= "GenerateResourceFiles" BeforeTargets= "PrepareForBuild" >
2026-02-06 16:12:44 -08:00
<Exec Command= "powershell -NonInteractive -executionpolicy Unrestricted $(RepoRoot)tools\build\convert-resx-to-rc.ps1 $(MSBuildThisFileDirectory) resource.base.h resource.h PowerRenameExt.base.rc PowerRenameExt.rc" />
2022-05-11 13:35:18 +03:00
</Target>
<PropertyGroup Label= "Globals" >
<VCProjectVersion > 15.0</VCProjectVersion>
<ProjectGuid > {B25AC7A5-FB9F-4789-B392-D5C85E948670}</ProjectGuid>
<RootNamespace > PowerRenameExt</RootNamespace>
</PropertyGroup>
<PropertyGroup Label= "Configuration" >
<ConfigurationType > DynamicLibrary</ConfigurationType>
<TargetName > PowerToys.PowerRenameExt</TargetName>
2026-02-06 16:12:44 -08:00
<OutDir > $(RepoRoot)$(Platform)\$(Configuration)\WinUI3Apps\</OutDir>
2022-05-11 13:35:18 +03:00
</PropertyGroup>
<PropertyGroup Label= "Configuration" >
[Dev][Build] VS 2026 Support (#44304)
<!-- Enter a brief description/summary of your PR here. What does it
fix/what does it change/how was it tested (even manually, if necessary)?
-->
## Summary of the Pull Request
This PR updates the PowerToys solution to support **Visual Studio 2026
(PlatformToolset v145)**. It centralizes the build configuration,
updates the C++ language standards, and fixes an issue with a MouseJump
unit test that appears while using the VS 2026 supported build agent.
<!-- Please review the items on the PR checklist before submitting-->
## PR Checklist
- [ ] Closes: #xxx
- [x] **Communication:** I've discussed this with core contributors
already. If the work hasn't been agreed, this work might be rejected
- [x] **Tests:** Added/updated and all pass
- [ ] **Localization:** All end-user-facing strings can be localized
- [x] **Dev docs:** Added/updated
- [ ] **New binaries:** Added on the required places
- [ ] [JSON for
signing](https://github.com/microsoft/PowerToys/blob/main/.pipelines/ESRPSigning_core.json)
for new binaries
- [ ] [WXS for
installer](https://github.com/microsoft/PowerToys/blob/main/installer/PowerToysSetup/Product.wxs)
for new binaries and localization folder
- [ ] [YML for CI
pipeline](https://github.com/microsoft/PowerToys/blob/main/.pipelines/ci/templates/build-powertoys-steps.yml)
for new test projects
- [ ] [YML for signed
pipeline](https://github.com/microsoft/PowerToys/blob/main/.pipelines/release.yml)
- [ ] **Documentation updated:** If checked, please file a pull request
on [our docs
repo](https://github.com/MicrosoftDocs/windows-uwp/tree/docs/hub/powertoys)
and link it here: #xxx
<!-- Provide a more detailed description of the PR, other things fixed,
or any additional comments/features here -->
## Detailed Description of the Pull Request / Additional comments
**Build System & Configuration:**
- Updated `Cpp.Build.props` to use `v145` (VS 2026) as the default
`PlatformToolset`, with fall back to `v143` for VS 2022.
- Configured C++ Language Standard:
- `stdcpplatest` for production projects.
- Removed explicit `<PlatformToolset>` definitions from individual
project files (approx. 37 modules) to inherit correctly from the central
`Cpp.Build.props`.
**Code Refactoring & Fixes:**
- Updated `DrawingHelperTests.cs` in MouseJump Unit Test to ease the
pixel difference tolerance. This became an issue after switching to the
new VS2026 build agent.
<!-- Describe how you validated the behavior. Add automated tests
wherever possible, but list manual validation steps taken as well -->
## Validation Steps Performed
- Validated successful compilation of the entire solution. Similar
updates have been made to the .NET 10 branch, but these are much cleaner
and will be merged into that branch once fully confirmed working.
---------
Co-authored-by: Kai Tao (from Dev Box) <kaitao@microsoft.com>
Co-authored-by: Gordon Lam (SH) <yeelam@microsoft.com>
2026-01-28 18:46:34 -05:00
2022-05-11 13:35:18 +03:00
</PropertyGroup>
<Import Project= "$(VCTargetsPath)\Microsoft.Cpp.props" />
<ItemDefinitionGroup >
<ClCompile >
2026-02-06 16:12:44 -08:00
<AdditionalIncludeDirectories > ..\lib\;..\PowerRenameUILib\;..\;$(RepoRoot)src\;$(RepoRoot)src\common\telemetry;..\..\;$(RepoRoot)src\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
2022-05-11 13:35:18 +03:00
</ClCompile>
<Link >
2025-11-04 09:27:16 +08:00
<AdditionalDependencies > Pathcch.lib;comctl32.lib;shcore.lib;windowscodecs.lib;%(AdditionalDependencies)</AdditionalDependencies>
2022-05-11 13:35:18 +03:00
<ModuleDefinitionFile > PowerRenameExt.def</ModuleDefinitionFile>
<DelayLoadDLLs > gdi32.dll;shell32.dll;ole32.dll;shlwapi.dll;oleaut32.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
</Link>
</ItemDefinitionGroup>
<ItemGroup >
<ClInclude Include= "CLSID.h" />
<ClInclude Include= "Generated Files/resource.h" />
<ClInclude Include= "PowerRenameConstants.h" />
<ClInclude Include= "PowerRenameExt.h" />
refactor: Replace WiX-based registration with conditional runtime registration for Win10 context menu modules (#41275)
<!-- Enter a brief description/summary of your PR here. What does it
fix/what does it change/how was it tested (even manually, if necessary)?
-->
## Summary of the Pull Request
## Root Cause
WiX-based registration creates persistent Shell Extension entries that:
1. Load DLLs even when the module is disabled
2. Cause cross-OS version conflicts (Win11 loading Win10 extensions)
## Changes Made
1. Removed static Shell Extension registration from PowerToys installer
2. Modified modules to register Shell Extensions during Runner startup
### Modified Modules:
- **PowerRename** (`src/modules/powerrename/dll/dllmain.cpp`)
- **NewPlus**
(`src/modules/NewPlus/NewShellExtensionContextMenu/powertoys_module.cpp`)
- **ImageResizer** (`src/modules/imageresizer/dll/dllmain.cpp`)
- **FileLocksmith**
(`src/modules/FileLocksmith/FileLocksmithExt/PowerToysModule.cpp`)
## Known Migration Issue
**Machine-level installer registry residue**: win10 with machine-level
installers may have residual Shell Extension registry entries that
persist with this change.
<!-- Please review the items on the PR checklist before submitting-->
## PR Checklist
- [x] Closes: #40036
- [ ] **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
- [ ] [JSON for
signing](https://github.com/microsoft/PowerToys/blob/main/.pipelines/ESRPSigning_core.json)
for new binaries
- [ ] [WXS for
installer](https://github.com/microsoft/PowerToys/blob/main/installer/PowerToysSetup/Product.wxs)
for new binaries and localization folder
- [ ] [YML for CI
pipeline](https://github.com/microsoft/PowerToys/blob/main/.pipelines/ci/templates/build-powertoys-steps.yml)
for new test projects
- [ ] [YML for signed
pipeline](https://github.com/microsoft/PowerToys/blob/main/.pipelines/release.yml)
- [ ] **Documentation updated:** If checked, please file a pull request
on [our docs
repo](https://github.com/MicrosoftDocs/windows-uwp/tree/docs/hub/powertoys)
and link it here: #xxx
<!-- Provide a more detailed description of the PR, other things fixed,
or any additional comments/features here -->
## Detailed Description of the Pull Request / Additional comments
<!-- Describe how you validated the behavior. Add automated tests
wherever possible, but list manual validation steps taken as well -->
## Validation Steps Performed
## AI Summary
This pull request refactors how shell extension registry keys are
managed during installation and uninstallation for several PowerToys
modules. The main change is moving registry key cleanup logic for
context menu shell extensions (ImageResizer, FileLocksmith, PowerRename,
NewPlus) from static installer definitions to new custom uninstall
actions, ensuring more reliable removal and future extensibility.
**Installer and Uninstall Refactoring**
* Added new custom actions (`CleanImageResizerRuntimeRegistryCA`,
`CleanFileLocksmithRuntimeRegistryCA`,
`CleanPowerRenameRuntimeRegistryCA`, `CleanNewPlusRuntimeRegistryCA`) to
programmatically clean up registry keys for each shell extension during
uninstall, implemented in `CustomAction.cpp` and exported in
`CustomAction.def`.
[[1]](diffhunk://#diff-c502a81cdf8afa7a38f0f462709abcdbdfcc44beaa6227a1e64a26566c7e8876R1156-R1262)
[[2]](diffhunk://#diff-f941d599be5fe41667eda00338af694c0f2e65709d497a66487402f13e408200R31-R34)
* Registered these custom actions in `Product.wxs` and ensured they run
before file removal during uninstall.
[[1]](diffhunk://#diff-668b4388b55bb934d7ceccbfdd172f69257c9c607ca19cb9752d4a4940b69886R179-R190)
[[2]](diffhunk://#diff-668b4388b55bb934d7ceccbfdd172f69257c9c607ca19cb9752d4a4940b69886R454-R482)
**Removal of Static Registry Key Definitions**
* Removed static registry key and component definitions for context menu
shell extensions from their respective installer `.wxs` files
(`FileLocksmith.wxs`, `ImageResizer.wxs`, `PowerRename.wxs`,
`NewPlus.wxs`), relying on custom actions for cleanup instead.
[[1]](diffhunk://#diff-7cf9797f8cb6609049763b3b830f6c4a7a02ba5705eb090f7e06fb9c270ca74fL17-L31)
[[2]](diffhunk://#diff-7cf9797f8cb6609049763b3b830f6c4a7a02ba5705eb090f7e06fb9c270ca74fL41)
[[3]](diffhunk://#diff-c6d00805ce9de0eb3f4d42874dccac17be62f36c35d57e8f863b928b5f955d3aL19-L83)
[[4]](diffhunk://#diff-c6d00805ce9de0eb3f4d42874dccac17be62f36c35d57e8f863b928b5f955d3aL93)
[[5]](diffhunk://#diff-d0d69eff3f2d7982679465972b7d3c46dd8006314fb28f0e3a2371e2d5ccedb0L21-L33)
[[6]](diffhunk://#diff-d0d69eff3f2d7982679465972b7d3c46dd8006314fb28f0e3a2371e2d5ccedb0L43)
[[7]](diffhunk://#diff-4fd109f66b896577cad2860a829617ca902b33551afaaa8840372035ade2d3f3L17-L32)
[[8]](diffhunk://#diff-4fd109f66b896577cad2860a829617ca902b33551afaaa8840372035ade2d3f3L42)
**Project File Update**
* Added `shell_ext_registration.h` to the solution file, possibly for
future shell extension registration logic.
These changes improve uninstall reliability and centralize registry
cleanup logic, making future maintenance and extension of shell
extension registration much simpler.
---------
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-08-21 18:10:30 +08:00
<ClInclude Include= "RuntimeRegistration.h" />
2022-05-11 13:35:18 +03:00
<ClInclude Include= "pch.h" />
<None Include= "resource.base.h" />
<ClInclude Include= "targetver.h" />
</ItemGroup>
<ItemGroup >
<ResourceCompile Include= "Generated Files/PowerRenameExt.rc" />
<None Include= "PowerRenameExt.base.rc" />
</ItemGroup>
<ItemGroup >
<ClCompile Include= "dllmain.cpp" />
<ClCompile Include= "PowerRenameExt.cpp" />
<ClCompile Include= "pch.cpp" >
2024-03-22 03:29:14 -07:00
<PrecompiledHeader Condition= "'$(UsePrecompiledHeaders)' != 'false'" > Create</PrecompiledHeader>
2022-05-11 13:35:18 +03:00
</ClCompile>
</ItemGroup>
<ItemGroup >
<None Include= "packages.config" />
<None Include= "PowerRenameExt.def" />
</ItemGroup>
<ItemGroup >
2026-02-06 16:12:44 -08:00
<ProjectReference Include= "$(RepoRoot)src\common\Display\Display.vcxproj" >
2022-05-11 13:35:18 +03:00
<Project > {caba8dfb-823b-4bf2-93ac-3f31984150d9}</Project>
</ProjectReference>
2026-02-06 16:12:44 -08:00
<ProjectReference Include= "$(RepoRoot)src\common\logger\logger.vcxproj" >
2022-05-11 13:35:18 +03:00
<Project > {d9b8fc84-322a-4f9f-bbb9-20915c47ddfd}</Project>
</ProjectReference>
2026-02-06 16:12:44 -08:00
<ProjectReference Include= "$(RepoRoot)src\common\Telemetry\EtwTrace\EtwTrace.vcxproj" >
2024-10-24 22:04:32 +02:00
<Project > {8f021b46-362b-485c-bfba-ccf83e820cbd}</Project>
</ProjectReference>
2026-02-06 16:12:44 -08:00
<ProjectReference Include= "$(RepoRoot)src\common\Themes\Themes.vcxproj" >
2022-05-11 13:35:18 +03:00
<Project > {98537082-0fdb-40de-abd8-0dc5a4269bab}</Project>
</ProjectReference>
<ProjectReference Include= "..\lib\PowerRenameLib.vcxproj" >
<Project > {51920f1f-c28c-4adf-8660-4238766796c2}</Project>
</ProjectReference>
</ItemGroup>
<ItemGroup >
<None Include= "Resources.resx" />
</ItemGroup>
<Import Project= "$(VCTargetsPath)\Microsoft.Cpp.targets" />
2026-02-06 16:12:44 -08:00
<Import Project= "$(RepoRoot)deps\spdlog.props" />
2022-05-11 13:35:18 +03:00
<ImportGroup Label= "ExtensionTargets" >
2026-02-06 16:12:44 -08:00
<Import Project= "$(RepoRoot)packages\Microsoft.Windows.CppWinRT.2.0.240111.5\build\native\Microsoft.Windows.CppWinRT.targets" Condition= "Exists('$(RepoRoot)packages\Microsoft.Windows.CppWinRT.2.0.240111.5\build\native\Microsoft.Windows.CppWinRT.targets')" />
<Import Project= "$(RepoRoot)packages\boost.1.87.0\build\boost.targets" Condition= "Exists('$(RepoRoot)packages\boost.1.87.0\build\boost.targets')" />
<Import Project= "$(RepoRoot)packages\boost_regex-vc143.1.87.0\build\boost_regex-vc143.targets" Condition= "Exists('$(RepoRoot)packages\boost_regex-vc143.1.87.0\build\boost_regex-vc143.targets')" />
2022-05-11 13:35:18 +03:00
</ImportGroup>
<Target Name= "EnsureNuGetPackageBuildImports" BeforeTargets= "PrepareForBuild" >
<PropertyGroup >
<ErrorText > 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}.</ErrorText>
</PropertyGroup>
2026-02-06 16:12:44 -08:00
<Error Condition= "!Exists('$(RepoRoot)packages\Microsoft.Windows.CppWinRT.2.0.240111.5\build\native\Microsoft.Windows.CppWinRT.props')" Text= "$([System.String]::Format('$(ErrorText)', '$(RepoRoot)packages\Microsoft.Windows.CppWinRT.2.0.240111.5\build\native\Microsoft.Windows.CppWinRT.props'))" />
<Error Condition= "!Exists('$(RepoRoot)packages\Microsoft.Windows.CppWinRT.2.0.240111.5\build\native\Microsoft.Windows.CppWinRT.targets')" Text= "$([System.String]::Format('$(ErrorText)', '$(RepoRoot)packages\Microsoft.Windows.CppWinRT.2.0.240111.5\build\native\Microsoft.Windows.CppWinRT.targets'))" />
<Error Condition= "!Exists('$(RepoRoot)packages\boost.1.87.0\build\boost.targets')" Text= "$([System.String]::Format('$(ErrorText)', '$(RepoRoot)packages\boost.1.87.0\build\boost.targets'))" />
<Error Condition= "!Exists('$(RepoRoot)packages\boost_regex-vc143.1.87.0\build\boost_regex-vc143.targets')" Text= "$([System.String]::Format('$(ErrorText)', '$(RepoRoot)packages\boost_regex-vc143.1.87.0\build\boost_regex-vc143.targets'))" />
2022-05-11 13:35:18 +03:00
</Target>
2019-10-17 20:57:19 -07:00
</Project>