Manifest Mode & vcpkg.json
The manifest, vcpkg.json, is to vcpkg what conanfile.txt is to Conan: a committed list of what your project needs. It's JSON with a published schema, so editors can complete and validate it.
A complete manifest
{
"$schema": "https://raw.githubusercontent.com/microsoft/vcpkg-tool/main/docs/vcpkg.schema.json",
"name": "wordstat",
"version": "1.0.0",
"builtin-baseline": "5d4a3dc90c0b3773f3bac81bf41297b54328f471",
"dependencies": [
"fmt",
{ "name": "spdlog", "default-features": false },
{ "name": "openssl", "platform": "!windows" }
],
"features": {
"tests": {
"description": "Build the unit tests",
"dependencies": [ "catch2" ]
}
},
"overrides": [
{ "name": "fmt", "version": "12.2.0", "port-version": 1 }
]
}| Field | Meaning |
|---|---|
name, version |
optional for applications; required when the manifest is itself a port |
builtin-baseline |
the vcpkg commit whose port versions you get (Baselines) |
dependencies |
port names, or objects with features, default-features, platform, version>=, host |
features |
optional parts of your project, each with its own dependencies |
overrides |
force an exact version of a port, ignoring the baseline and constraints |
supports |
platforms your project supports, e.g. "!uwp & !arm" |
platform uses vcpkg's platform expressions: windows, linux, osx, android, x64, arm64, static, combined with &, | and !.
Starting a manifest
vcpkg new --application writes an empty vcpkg.json and a vcpkg-configuration.json whose default registry is the vcpkg GitHub repository at the current commit. That form fetches the registry from GitHub, which our offline container can't do, so this course uses the equivalent builtin-baseline field, which reads the local vcpkg clone. vcpkg add port edits the manifest for you:
mkdir -p app && cd app
echo '{ "builtin-baseline": "5d4a3dc90c0b3773f3bac81bf41297b54328f471" }' > vcpkg.json
vcpkg add port spdlog catch2
cat vcpkg.json
vcpkg format-manifest vcpkg.json > /dev/null && cat vcpkg.jsonSucceeded in adding ports to vcpkg.json file.
{
"builtin-baseline": "5d4a3dc90c0b3773f3bac81bf41297b54328f471",
"dependencies": [
"spdlog",
"catch2"
]
}
{
"builtin-baseline": "5d4a3dc90c0b3773f3bac81bf41297b54328f471",
"dependencies": [
"catch2",
"spdlog"
]
}
vcpkg format-manifest rewrites the file in canonical order and formatting, which keeps diffs small when several people edit it.
Installing a manifest
mkdir -p app && cd app
cat > vcpkg.json <<'JSON'
{
"name": "app",
"version": "1.0.0",
"builtin-baseline": "5d4a3dc90c0b3773f3bac81bf41297b54328f471",
"dependencies": [ "spdlog" ],
"features": {
"tests": { "description": "Build the unit tests", "dependencies": [ "catch2" ] }
}
}
JSON
vcpkg install 2>&1 | grep -E 'will be built|^ +[*]? *[a-z0-9-]+(\[.*\])?:x64-linux|Restored|completed successfully'
echo "--- with the tests feature"
vcpkg install --x-feature=tests 2>&1 | grep -E 'already installed|will be|^ +[*]? *[a-z0-9-]+(\[.*\])?:x64-linux|Restored|completed successfully'
ls vcpkg_installed/x64-linux/libThe following packages will be built and installed:
* fmt:x64-linux@12.2.0#1
spdlog[core,fmt,tz-offset]:x64-linux@1.17.0#1
* vcpkg-cmake:x64-linux@2025-08-07
* vcpkg-cmake-config:x64-linux@2026-07-21
Restored 4 package(s) from /opt/vcpkg-cache in 95.8 ms. Use --debug to see more details.
All requested installations completed successfully in: 25.3 ms
--- with the tests feature
The following packages are already installed:
* fmt:x64-linux@12.2.0#1
spdlog[core,tz-offset,fmt]:x64-linux@1.17.0#1
* vcpkg-cmake:x64-linux@2025-08-07
* vcpkg-cmake-config:x64-linux@2026-07-21
The following packages will be built and installed:
catch2:x64-linux@3.16.0
Restored 1 package(s) from /opt/vcpkg-cache in 222 ms. Use --debug to see more details.
All requested installations completed successfully in: 14 ms
libCatch2.a
libfmt-c.a
libfmt.a
libspdlog.a
manual-link
pkgconfig
spdlog[core,fmt,tz-offset]shows the port's features that were selected:corealways, plus spdlog's default features.- The second install lists what is already installed, then adds
catch2because thetestsfeature was requested; the packages already installed were kept. From CMake, the same switch is-DVCPKG_MANIFEST_FEATURES=tests. - Re-running
vcpkg installis cheap: it compares what's installed with what the manifest asks for and only changes the difference.
What goes in Git
| Path | Commit? |
|---|---|
vcpkg.json |
yes |
vcpkg-configuration.json (registries, overlays) |
yes |
vcpkg_installed/ |
no, it's generated |
| a lockfile | vcpkg has none: the baseline commit plus your constraints and overrides fully determine the versions |
That last row is a real design difference from Conan. A vcpkg manifest with a builtin-baseline is already reproducible: the same baseline always gives the same versions, because port versions at a given commit never change.
Test yourself
Which field makes a vcpkg manifest's versions reproducible?
- name
- builtin-baseline (or the default registry's baseline)
- features
- supports
How do you make a dependency apply only to non-Windows builds?
- Use a separate manifest
- { "name": "openssl", "platform": "!windows" }
- Put it in overrides
- It isn't possible
What does a manifest features entry describe?
- Features of vcpkg itself
- Optional parts of your project, each with extra dependencies, enabled with --x-feature or VCPKG_MANIFEST_FEATURES
- C++ language features
- Compiler flags