Docker build for Windows containers: "COPY failed: file not found in build context or excluded by .dockerignore"

I want to create a Windows Docker container.

So, I created a local directory, added all the necessary context files in there and added a Dockerfile to it.

The Dockerfile (in its current state) just defines some variables and a COPY instruction:

# escape=`
FROM mcr.microsoft.com/windows/servercore:20H2
ARG VSPath
ENV VSPath=${VSPath:-"C:\VsBuildInstall\"}
COPY [ "\LocalLayout\", $VSPath ]
...

When I try to build an image from this Dockerfile, I get the following error message:

docker build --rm -t test:latest '.'

Step 1/12 : FROM mcr.microsoft.com/windows/servercore:20H2
 ---> d7c03b5bcc73
...
Step 9/12 : COPY [ "\LocalLayout\", $VSPath ]
COPY failed: file not found in build context or excluded by .dockerignore: stat LocalLayout\,: file does not exist

According to the documentation, everything in my Dockerfile seems fine.

What am I doing wrong here?

Just for the sake of completeness and because I have no clue where to look for issues in my setup, I’ll add a VS Code screenshot here:

In the meantime, after checking the Docker source code, I realized that the Docker documentation is wrong to this regard. So, I opened an issue here: github.com/docker/docs/issues/19922