Problem reading/writing docker volume from Visual Studio on Windows

I am prototyping a C# application for docker that has capability for reading and writing files. I am using WSL2 on my Windows 10 PC. I am running my application from Visual Studio.

I created a docker volume manually using this syntax: Docker volume create –name=MyVolume

As expected it creates a folder in this location: \wsl$\docker-desktop-data\version-pack-data\community\docker\volumes\MyVolume

Here is my docker-compose.yml :

version: '3.4'

services:
  myservice:
    image: ${DOCKER_REGISTRY-}myservice
    build:
      context: .
      dockerfile: MyService/Dockerfile
    volumes:
      - MyVolume:/data

volumes:
    MyVolume:
      external: true

I set my startup project to docker-compose and run via the Docker Compose button.

Problem : when I write a file (using File.Create), the file gets written to my application directory, not to the docker volume.

What am I doing wrong?