Draft
Conversation
Co-authored-by: lejcik <34658965+lejcik@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Update PR workflow to integrate vcpkg before MSBuild
ci: set up vcpkg in PR build workflow
Mar 11, 2026
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.
GitHub Actions runners have no vcpkg integration, so MSBuild silently skips the vcpkg step and the build fails with missing headers/libs. Locally,
vcpkg integrate installruns once and registers global MSBuild.props/.targets, which is why it works on developer machines.Changes
microsoft/vcpkgintovcpkg/at workspace root (source stays ins/)bootstrap-vcpkg.bat -disableMetricsvcpkg/installedkeyed onrunner.os+hashFiles('s/**/vcpkg.json')to avoid rebuilding packages on every runvcpkg integrate installso MSBuild picks up vcpkg's.props/.targetsand builds manifest dependencies automaticallyVCPKG_ROOTenv var on the MSBuild stepOriginal prompt
Problem
The PR build workflow (
.github/workflows/pr-msbuild.yml) does not set up vcpkg before invoking MSBuild. The project uses.vcxprojfiles with avcpkg.jsonmanifest for dependencies (e.g.bzip3and others). On a developer's local machine,vcpkg integrate installhas been run once, which registers a global MSBuild.props/.targetsfile — so it works transparently. On the GitHub Actions runner, none of that integration exists, so vcpkg never bootstraps and the dependent libraries are never built.The project's
.vcxprojfiles reference$(_ZVcpkgCurrentInstalledDir)includefor include paths, which confirms vcpkg integration is expected to be active during the build. Without the integration, MSBuild silently skips the vcpkg step and the build fails with missing headers/libs.Solution
Update
.github/workflows/pr-msbuild.ymlto:microsoft/vcpkg) into avcpkg/directory at the workspace root (separate from the source checkout which goes intos/).bootstrap-vcpkg.bat -disableMetrics.actions/cache@v4, keyed on the hash of allvcpkg.jsonfiles in the repo, to avoid rebuilding packages from source on every run.vcpkg integrate installso that MSBuild automatically picks up vcpkg's.props/.targetsand builds the manifest dependencies before compiling.VCPKG_ROOTenvironment variable on the MSBuild step so the toolchain can locate vcpkg if needed.Implementation Details
working-directoryfor the bootstrap and integrate steps should be${{ github.workspace }}(not thes/subdirectory used as the default for the source).vcpkg/installedand the cache key should incorporate${{ runner.os }}and${{ hashFiles('s/**/vcpkg.json') }}.Build via MSBuild) should haveVCPKG_ROOT: ${{ github.workspace }}\vcpkgadded to itsenv:block.Files to Modify
.github/workflows/pr-msbuild.ymlThe following is the prior conversation context from the user's chat exploration (may be truncated):
User: it looks like my dependencies were not built, my configuration is .vcxproj project file with vcpkg.json for the dependent libraries, I don't see in the log that vcpkg built the requested libraries (bzip3 and others), while local build on my PC succeeds, any idea what may be wrong?
Assistant: I found the root cause. After reviewing your workflow (
pr-msbuild.yml) and your project files, here's what's happening and why:🔍 Root Cause: vcpkg is Not Set Up in the Workflow
Your workflow does not have a step to bootstrap or integrate vcpkg. The projects rely on vcpkg (they reference
$(_ZVcpkgCurrentInstalledDir)includefor headers), but the CI runner has no knowledge of where vcpkg is or how to use it.On your local machine, Visual Studio has a vcpkg integration (
vcpkg integrate install) that was run once and registered a global MSBuild.props/.targetsfile. This is what makes it "just work" locally. The GitHub Actions runner has none of that.✅ What You Need to Add to the Workflow
You need to add steps to:
.vcxprojpicks it up automaticallyHere's the updated workflow with the necessary vcpkg steps: