Support for Visual Studio Code¶
Whilst Turbo Build Accelerator was originally designed to be used with Microsoft Visual Studio, it is also perfectly usable from Microsoft Visual Studio Code.
The following setup allows you to Build and Debug from VSCode, whilst using CMake to generate Visual Studio Solution and Project files. Since builds will be using msbuild.exe then building with Turbo Build Accelerator is supported.
Required Extensions¶
- 'msbuild tools' by Sterin
- 'c/c++' by Microsoft
- 'c/c++ Extension Pack' by Microsoft
- 'CMake Tools' by Microsoft
Setup¶
Install the above list of extensions.
Ensure you have the 'build tools for Visual Studio' component installed from the Visual Studio installation tool.
Open a Visual Studio 'Command Prompt' window for the desired Visual Studio version and target architecture (x86/x64). Launch the VS Code IDE like this "C:\Program Files\Microsoft VS Code\Code.exe".
Use the VSCode Explorer to navigate to the folder containing your Visual Studio Solution file.
There should be a .vscode folder visible in the VS Code explorer sidebar. In there, create a file called msbuild-tools.json and add contents to it as in below example for Poco's JSON Solution :
{
"solution": "${workspaceRoot}/JSON_vs160.sln",
"variables": {
"MSBUILD": "C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/MSBuild/Current/Bin/MSBuild.exe",
"DEVENV": "C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/Common7/IDE/devenv.com"
},
"buildConfigurations": [
"debug_shared",
"release_shared"
],
"platformConfigurations": [
"x86",
"x64"
],
"debugConfigurations": [
{
"name": "test",
"cwd": "${workspaceRoot}",
"program": "${workspaceRoot}/testsuite/bin64/TestSuite.exe",
"args": ["-all"]
}
],
"preBuildTasks": [
{
"name": "Print a message",
"program": "cmd",
"args": [ "/c", "echo [pre-build task]: Pre-Build Task goes here" ],
"cwd": "${workspaceRoot}"
}
],
"postBuildTasks": [
{
"name": "Print another message",
"program": "cmd",
"args": [ "/c", "echo [post-build task]: Post-Build Task goes here" ],
"cwd": "${workspaceRoot}"
}
]
}
Then use the Turbo Build tool turbo-vs-solution-enabler.exe to enable (or disable) Turbo build support for that VS Solution.
Now you can build within the VS Code environment with Turbo Build acceleration as seen in below screenshot :
In the above screenshot note the :
- lower "output" window shows Turbo Build log output (in debug verbosity)
- upper 'code window' shows
msbuild-tools.json
You can also debug within the VS Code environment. Use the Command Bar (Ctrl+Shift+p) and type "msbuild" to see possible commands (see screenshot below).
For other background info see Visual Studio Code with Microsoft c++ compiler
Tested with VSCode v1.105.1, and 'msbuild-tools' v0.0.12.