Skip to content

UE 5.7: blocks_genprojfiles_vscode.bat fails — launch.json no longer written to .vscode/ (moved into .code-workspace) #169

Description

@rennsport-007

Bug report

  • Project AirSim Version/#commit: main branch, cloned July 2026
  • autopilot version: N/A
  • OS Version: Windows 10.0.26200.8457

What's the issue you encountered?

Running unreal\Blocks\blocks_genprojfiles_vscode.bat on a clean checkout with UE 5.7 fails at the final Python step with a FileNotFoundError because .vscode\launch.json is never created.

Root cause: UE 5.7 changed VSCodeProjectFileGenerator.cs (Engine\Source\Programs\UnrealBuildTool\ProjectFiles\VisualStudioCode\VSCodeProjectFileGenerator.cs) so that WriteTasks() and WriteLaunch() now write directly into the "tasks" and "launch" keys of the generated .code-workspace file, instead of writing standalone .vscode\tasks.json / .vscode\launch.json files (the behavior in UE 5.2 and earlier). Relevant snippet from UE 5.7's generator:
WorkspaceFile.BeginObject("tasks");
WriteTasks(WorkspaceFile, ProjectData);
WorkspaceFile.EndObject();
WorkspaceFile.BeginObject("launch");
WriteLaunch(WorkspaceFile, ProjectData, Logger);
WorkspaceFile.EndObject();
...
WorkspaceFile.Write(FileReference.Combine(PrimaryProjectPath, WorkspaceName + ".code-workspace"));

Since blocks_genprojfiles_vscode.bat's for /f rename loop and tools\update_blocks_vscode.py both assume a standalone .vscode\launch.json exists (matching UE ≤5.2 behavior), both fail on a clean UE 5.7 setup — even though the repo's own docs list UE 5.7 as officially supported.

Settings

N/A

How can the issue be reproduced?

  1. Set UE_ROOT to a UE 5.7 install (5.7.4 in my case)
  2. Clone repo, run unreal\Blocks\blocks_genprojfiles_vscode.bat (no sim libs need to be built first — reproduces either way)
  3. UBT reports Result: Succeeded and generates Blocks.code-workspace, c_cpp_properties.json, and compileCommands_*.json inside .vscode\
  4. .vscode\launch.json is never created
  5. Script fails with the error below

Include full error message in text form

1 file(s) moved.

The system cannot find the file .vscode\launch.json.
The system cannot find the file specified.
Traceback (most recent call last):
File "...\unreal\Blocks....\tools\update_blocks_vscode.py", line 87, in
main()
File "...\unreal\Blocks....\tools\update_blocks_vscode.py", line 82, in main
update_launch_json(vscode_dir)
File "...\unreal\Blocks....\tools\update_blocks_vscode.py", line 43, in update_launch_json
launch = json.loads(launch_path.read_text(encoding="utf-8"))
FileNotFoundError: [Errno 2] No such file or directory: '...\unreal\Blocks.vscode\launch.json'

Suggested fix

Before the existing for /f rename loop in blocks_genprojfiles_vscode.bat, extract the "launch" section out of the generated .code-workspace file into a standalone .vscode\launch.json (written without a UTF-8 BOM, since Python's default utf-8 decoder throws on one):

if not exist .vscode mkdir .vscode
powershell -NoProfile -Command "$ws = Get-Content -Raw '.\Blocks.code-workspace' | ConvertFrom-Json; $json = $ws.launch | ConvertTo-Json -Depth 10; [System.IO.File]::WriteAllText((Join-Path (Get-Location) '.vscode\launch.json'), $json, [System.Text.UTF8Encoding]::new($false))"

Additionally, tools\update_blocks_vscode.py line 43 should decode with utf-8-sig instead of utf-8, as a defensive measure against BOM-prefixed JSON from any source:

launch = json.loads(launch_path.read_text(encoding="utf-8-sig"))

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions