Access to any relative binaryDir path is denied inside Visual Studio

When I open a CMake project with Visual Studio 2022 Preview (17.4.0 Preview 3) and use

"binaryDir": "foo"

inside a preset in CMakePresets.json, I get an error when configuring the project

1> Access to the path 'foo' is denied.
Access to the path 'foo' is denied.
   at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
   at System.IO.Directory.InternalCreateDirectory(String fullPath, String path, Object dirSecurityObj, Boolean checkHost)
   at System.IO.Directory.InternalCreateDirectoryHelper(String path, Boolean checkHost)
   at Microsoft.VisualStudio.CMake.Project.ExternalBuildProject.ProjectProvider.<ParseProjectAsync>d__46.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
...

After switching to

"binaryDir": "${sourceDir}/foo"

it starts working.

Documentation at https://cmake.org/cmake/help/latest/manual/cmake-presets.7.html#configure-preset says

If a relative path is specified, it is calculated relative to the source directory.

So I’m confused if this is a bug somewhere in CMake/Visual Studio or if I’m just misinterpreting the documentation.

My guess is Visual Studio has not implemented the relative path correctly.

Thank you, I filed a bug report, let’s see what Microsoft says.