Visual Studio DockerfileBuildArguments with enviroment variables not works

  docker, visual-studio

In docker i need to pass 2 arguments for restore my private nuget packages

docker build -t backend-template --build-arg ARTIFACTS_PAT=My-pat --build-arg ARTIFACTS_ENDPOINT=My-endpoint .

When i pass this arguments on DockerfileBuildArguments tag in api.csproj as environment variables the build not works
enter image description here
enter image description here

This is the command that VS runs

docker build -f "C:UsersmatmahnkeDocumentsreposmyprojectDockerfile" --force-rm -t ymstemplatebackendapi:dev --target build --build-arg ARTIFACTS_PAT= --build-arg ARTIFACTS_ENDPOINT= --label "" --label "" "C:UsersmatmahnkeDocumentsreposmyproject"

I need it to be an environment variable to add to gitignore

Source: Docker Questions