[vcpkg.targets] Skip applocal when the installed bin directory does not exist - #54330
Open
Alexandre Zollinger Chohfi (azchohfi) wants to merge 2 commits into
Open
Alexandre Zollinger Chohfi (azchohfi) wants to merge 2 commits into
Alexandre Zollinger Chohfi (azchohfi) wants to merge 2 commits into
Conversation
…ot exist AppLocalFromInstalled starts vcpkg.exe z-applocal after every link, to copy DLLs from installed\<triplet>\[debug\]bin next to the binary. When that directory does not exist, there is nothing it could copy. This happens with the user-wide integration (vcpkg integrate install) in every C++ project that uses no vcpkg packages, including the compiler-identification and try_compile projects that CMake's Visual Studio generator builds. Add Exists() on that directory to the target's condition. Target conditions are evaluated when the target is about to run, so in manifest mode the directory created by VcpkgInstallManifestDependencies earlier in the same build is seen.
Copilot started reviewing on behalf of
Alexandre Zollinger Chohfi (azchohfi)
October 6, 2026 04:15
View session
Contributor
There was a problem hiding this comment.
Copilot review overview
🟢 Approval recommended
The focused condition uses the existing app-local path and is supported by relevant manual testing.
Review effort: Balanced
Findings: None
What changed in this PR
Avoids unnecessary MSBuild app-local deployment when the selected vcpkg binary directory is absent.
Changes:
- Adds an execution-time directory existence check to
AppLocalFromInstalled. - Preserves manifest-mode behavior after dependency installation.
| File | Description |
|---|---|
scripts/buildsystems/msbuild/vcpkg.targets |
Skips app-local deployment when no installed bin directory exists. |
💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Pre-existing, reported by the PR whitespace check when the file is edited.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
AppLocalFromInstalledruns after every link and startsvcpkg.exe z-applocalto copy DLLs frominstalled\<triplet>\[debug\]binnext to the binary. When that directory does not exist, there isnothing to copy, but the process still starts. With the user-wide integration
(
vcpkg integrate install), this happens in every C++ project built with MSBuild on the machine,including ones that use no vcpkg packages. CMake's Visual Studio generator alone builds two such
projects in every fresh configure: the compiler-ID project and the ABI
try_compile.This adds one condition to the target:
The path is the same one the target already passes as
--installed-bin-dir.Manifest mode
MSBuild evaluates a target's
Conditionwhen the target is about to run, not when the project isloaded. In manifest mode,
VcpkgInstallManifestDependencies(BeforeTargets="ClCompile") hascreated
vcpkg_installed\<triplet>\...by then, so the check sees it. Tested below, on a projectwhose
vcpkg_installeddid not exist before the build.Testing
Each case is a full
-t:Rebuildof a real linked C++ project, CMake's generatedCompilerIdCXX.vcxproj, at-v:d. It records whetherAppLocalFromInstalledran and what itcopied. Integration from this branch; vcpkg-tool 2026-09-26.
AppLocalFromInstalledinstalled\tree, without this changez-applocal, copies nothing)installed\tree, with this changeinstalled\x64-windows\bin) holds a DLL the binary importsbinanddebug\bin;vcpkg_installedabsent before the buildvcpkg_installedcreated, nobin)No CI or test in this repository covers
scripts/buildsystems/msbuild.git diff --checkisclean. Not tested:
x86/arm64triplets, static triplets,vcpkg export --nugetpackages,Release configuration.
Numbers
CMake's Visual Studio 18 generator on a two-file C++ project with the user-wide integration and no
installed\tree. Each pass runs every case once, in rotating order; values are medians in ms,and the brackets are the 95% bootstrap CI of the per-pass paired difference. Windows 11, i9-14900K,
MSBuild 18.10, CMake 4.4.3.
cmake -S . -B build/cmake --build build(load canary 1.17 before, 1.12 after).
scripts/buildsystems/msbuildfiles are byte-identical to master's; 11 passes:+1 [−20, 90].
Context
#52315 made
z-applocalthe default instead ofpwsh applocal.ps1, which removed most of thiscost (about 1.2 s per configure on a checkout from 2025). What remains is starting
vcpkg.exeonce per linked project when there is nothing to deploy.