WSL Rsync CMake
A self-contained WSL2 C++ build backend for Visual Studio Code and Kiro.
Mirrors the CMake remote build model used by Visual Studio 2022: before every
configure or build operation the extension syncs your Windows source tree into
WSL with rsync, then runs cmake and GDB entirely inside the named
WSL distribution — no cmake installation required on Windows.
Use at your own risk. See the LICENSE file for terms. No warranty of any kind is provided.
Table of Contents
- Requirements
- Installation
- Quick Start
- Activity Bar Panel
- Commands
- Settings Reference
- CMakePresets.json Integration
- GDB Debugging
- How It Works
- Troubleshooting
Requirements
| Requirement |
Notes |
| Windows 10/11 |
Extension runs only on Windows ("os": ["win32"]) |
| WSL2 |
A named WSL2 distribution must be installed and running |
| rsync |
Must be installed inside the WSL distribution: sudo apt install rsync |
| cmake |
Must be installed inside the WSL distribution: sudo apt install cmake |
| GDB (optional) |
Required for the wsl-gdb debug adapter: sudo apt install gdb |
| VS Code ≥ 1.85 |
Or Kiro (VS Code-compatible) |
| CMakeLists.txt |
Extension activates automatically when a workspace contains this file |
Installation
From a VSIX (current):
- Build or obtain
wsl-rsync-cmake-win32-x64-x.y.z.vsix (see Development).
- In VS Code / Kiro: Extensions panel →
··· → Install from VSIX…
- Select the
.vsix file.
- Reload the window when prompted.
Once published, it will also be installable from the VS Code Marketplace and the Open VSX Registry (search "WSL Rsync CMake").
Quick Start
Step 1 — Select WSL Distribution
Open the Command Palette (Ctrl+Shift+P) and run:
WSL Rsync CMake: Select Distribution
Choose your WSL distribution (e.g. FusionIDE, Ubuntu-22.04).
The selection is saved to wslRsyncCmake.distribution in your workspace settings.
WSL Rsync CMake: Select Configure Preset
The extension reads CMakePresets.json from your workspace root and shows only
Linux-compatible presets (those where hostOS is unset or contains "Linux"
anywhere in the inheritance chain). Display names are shown; selecting a preset
saves its internal name to wslRsyncCmake.configurePreset.
Click the 🔧🪛 Configure button in the Activity Bar panel, or run:
WSL Rsync CMake: Configure
This will:
- Sync your Windows workspace to WSL via rsync.
- Run
cmake --preset <name> (or cmake -S … -B … if no preset is selected).
Step 4 — Build
Click the $(build) Build button or run WSL Rsync CMake: Build.
This will:
- Sync the workspace again (only changed files).
- Run
cmake --build <buildDirectory>.
- Parse compiler output and show errors/warnings in the Problems panel as
navigable links.
Step 5 — Clean
Click 🗑 Clean to delete all build artefacts:
cmake --build <buildDirectory> --target clean
No rsync runs before clean.
Activity Bar Panel
Click the WSL Rsync CMake icon in the Activity Bar (left sidebar) to open the
panel.
WSL RSYNC CMAKE
├── Distribution FusionIDE ← click to change
├── Configure Yocto IDR-i3 debug ← click to change
└── Source Root /home/root/.vs/HAL.ref/
| Icon |
Command |
Description |
$(tools) |
Configure |
rsync + cmake configure |
$(build) |
Build |
rsync + cmake build |
$(trash) |
Clean |
cmake --target clean |
$(refresh) |
Reconnect |
Re-run the WSL connectivity probe |
Commands
All commands are available via the Command Palette (Ctrl+Shift+P):
| Command |
Description |
WSL Rsync CMake: Select Distribution |
Choose a WSL distribution from the installed list |
WSL Rsync CMake: Select Configure Preset |
Choose a Linux cmake preset from CMakePresets.json |
WSL Rsync CMake: Configure |
Sync + cmake configure |
WSL Rsync CMake: Build |
Sync + cmake build |
WSL Rsync CMake: Clean |
cmake --target clean (no sync) |
WSL Rsync CMake: Reconnect |
Cancel current probe and start a new one |
WSL Rsync CMake: Generate CMakePresets |
Write a starter CMakePresets.json to the workspace |
WSL Rsync CMake: Select Launch Target |
Pick the WSL executable used as the wsl-gdb launch target |
WSL Rsync CMake: Select Build Target |
Pick the cmake build target (all or a named target) |
Settings Reference
All settings live under the wslRsyncCmake namespace in your workspace
.vscode/settings.json.
| Setting |
Default |
Description |
wslRsyncCmake.distribution |
(unset) |
WSL distribution name, e.g. Ubuntu-22.04. Set via the Select Distribution command. |
wslRsyncCmake.configurePreset |
(unset) |
CMake configure preset name from CMakePresets.json. When set, cmake runs as cmake --preset <name>. |
wslRsyncCmake.wslCmakePath |
cmake |
Path to the cmake binary inside WSL. |
wslRsyncCmake.rsyncPath |
rsync |
Path to the rsync binary inside WSL. |
wslRsyncCmake.rsyncArgs |
["-t","--delete","--delete-excluded"] |
Extra rsync arguments (after the mandatory -r). |
wslRsyncCmake.rsyncExclusions |
[".vs",".git","out"] |
Paths excluded from the rsync sync. Each becomes --exclude=<item>. |
wslRsyncCmake.configureArgs |
[] |
Extra arguments appended to the cmake configure invocation. |
wslRsyncCmake.buildArgs |
[] |
Extra arguments appended to cmake --build. |
wslRsyncCmake.buildDirectory |
(derived) |
Absolute WSL path for the build directory. Default: <wslSourceRoot>build/<presetName> when a preset is set, otherwise <wslSourceRoot>build. |
wslRsyncCmake.buildTarget |
all |
cmake --target for build. all builds everything; set via Select Build Target. |
wslRsyncCmake.launchTarget |
(unset) |
Absolute WSL path to the wsl-gdb launch target. Set via Select Launch Target. |
Example workspace settings
{
"wslRsyncCmake.distribution": "FusionIDE",
"wslRsyncCmake.configurePreset": "yocto_idr_i3_debug"
}
CMakePresets.json Integration
Vendor map (rsync settings)
The extension reads the Visual Studio remote settings vendor map from your
CMakePresets.json:
"vendor": {
"microsoft.com/VisualStudioRemoteSettings/CMake/1.0": {
"sourceDir": "/home/root/.vs/MyProject/",
"copySources": true,
"rsyncCommandArgs": ["-t", "--delete", "--stats"],
"copySourcesOptions": {
"exclusionList": [".vs", ".git", "out", "build"]
}
}
}
Precedence: vendor map values win over wslRsyncCmake.* workspace settings.
| Vendor map key |
Overrides setting |
sourceDir |
WSL source root path |
copySources: false |
Skips rsync entirely |
rsyncCommandArgs |
wslRsyncCmake.rsyncArgs |
copySourcesOptions.exclusionList |
wslRsyncCmake.rsyncExclusions |
Linux preset selection
The Select Configure Preset command filters CMakePresets.json to only
show presets where:
hidden !== true
hostOS is unset or contains "Linux" (resolved through the full
inherits chain)
displayName is shown in the list; the internal name is saved to settings.
GDB Debugging
The extension provides a wsl-gdb debug configuration type that runs GDB
inside WSL and bridges it to VS Code's debug UI via the Debug Adapter Protocol.
launch.json example
{
"version": "0.2.0",
"configurations": [
{
"name": "WSL GDB Launch",
"type": "wsl-gdb",
"request": "launch",
"program": "/home/root/.vs/MyProject/build/myPreset/out/MyApp",
"distribution": "FusionIDE",
"args": []
}
]
}
Supported debug features
- Set / remove breakpoints
- Function breakpoints
- Step over / into / out
- Continue / pause
- Variable inspection
- Stack frames and scopes
- Expression evaluation
Requirements
gdb installed in the WSL distribution: sudo apt install gdb
program must be an absolute Linux path starting with /
distribution must be a running WSL distribution
How It Works
Windows workspace (D:\Dev\Project)
│
│ rsync via wsl.exe --exec rsync
▼
WSL source copy (/home/root/.vs/Project/)
│
│ wsl.exe --exec cmake --preset ... (or -S/-B)
▼
WSL build directory (/home/root/.vs/Project/build/presetName/)
│
│ Compiler diagnostics translated WSL→Windows
▼
VS Code Problems panel (navigable file:line links)
Process launch: All WSL processes (rsync, cmake, gdb) are started via:
%SystemRoot%\System32\wsl.exe -d <distribution> --cd <wslSourceRoot> --exec <program> [args...]
--exec bypasses the Linux shell — no shell interpretation, no console window.
--cd <wslSourceRoot> sets the working directory so cmake finds
CMakePresets.json in the project directory rather than the editor's install folder.
Distribution list: WSL distributions are enumerated directly from the
Windows registry (HKCU\Software\Microsoft\Windows\CurrentVersion\Lxss) via
a native N-API addon (wsl-native.node).
Troubleshooting
"WSL probe timed out after 5 seconds"
The WSL distribution did not respond within 5 seconds.
- Check that the distribution is installed:
wsl --list
- Try starting it manually:
wsl -d FusionIDE
- Click Reconnect in the Activity Bar panel after the distribution starts.
"rsync exited with code 1 — no output"
rsync could not start or failed immediately.
- Verify rsync is installed:
wsl -d FusionIDE --exec rsync --version
- If missing:
wsl -d FusionIDE -- sudo apt install rsync
"cmake --preset" not finding CMakePresets.json
Ensure a configure preset is selected via WSL Rsync CMake: Select Configure Preset
and that CMakePresets.json exists in the workspace root. The extension sets
cmake's working directory to the WSL source root automatically.
Build directory is wrong / "Error: could not load cache"
Run Configure before Build — the build directory does not exist until
cmake configure generates it.
Compiler errors not appearing in the Problems panel
Compiler diagnostics are only parsed during Build, not Configure. Make sure
the build step runs after a successful configure.
"command wsl-rsync-cmake.xxx not found"
The extension failed to activate. Check the Output Channel named WSL Rsync CMake
for error details. The most common cause is the N-API native addon
(wsl-native.node) failing to load — this requires wslapi.dll to be present
(standard on Windows 10/11 with WSL installed).
Development
Prerequisites
- Node.js ≥ 18 and npm.
- For the native addon: the node-gyp toolchain — Python 3 and Visual Studio Build Tools (Desktop C++). Windows only.
Build & test
npm install
npm run compile # tsc -> out/
npm run build:native # node-gyp -> build/Release/wsl-native.node (Windows)
npm test # Jest unit + property tests
npm run lint # ESLint
Press F5 to launch the Extension Development Host with the extension loaded (uses .vscode/launch.json). Run npm run build:native at least once first so the addon is present.
Project layout
.
├── .github/workflows/publish.yml CI: publish on tag push (see publishing caveat below)
├── .kiro/
│ ├── steering/ always-on rules + manual checklists (build-workflow, publish, local-vsix)
│ ├── specs/ wsl-rsync-cmake · rsync-checksum-skip · wsl-source-sync
│ └── IMPORT-DIFFERENCES.md notes from the import/rebrand of the previous project
├── src/ TypeScript sources (cmake · config · debug · diagnostics · sync · translation · ui · wsl) + native/ C++ addon
├── res/ icons
├── binding.gyp native addon build config
├── jest.config.ts Jest unit + integration projects
├── package.json · tsconfig.json · tsconfig.test.json · .eslintrc.json
└── LICENSE · README.md · RELEASE_NOTES.md
Package a VSIX
npm run package # vsce package --target win32-x64
This extension is platform-specific (Windows-only, native N-API addon), so it is packaged and published as a win32-x64 target. See .kiro/steering/local-vsix.md and .kiro/steering/publish.md for the full checklists, and .kiro/steering/versioning.md for the two-phase Release/Publish flow.
Publishing: .github/workflows/publish.yml builds the native addon on a Windows runner and publishes a win32-x64 VSIX to the Marketplace (OIDC Trusted Publishing) and Open VSX on a v* tag push. Before the first publish, set up the Marketplace Trusted Publishing policy, the OPEN_VSX_PAT secret, and the Open VSX namespace (see .kiro/steering/build-workflow.md).
License
Copyright © 2026 Adam Wiącek. See the LICENSE file for full terms.
Use at your own risk. No warranty of any kind is provided.