VisualStudio 2022 - docker compose - debugging does not work

Viewed 11

I created a simple solution .NET 6 and 2 WebApi projects. I added docker compose support to the solution for both projects. So it looks like this:

DockerInVS
  docker-compose*
  WebApp1
    Dockerfile
  WebApp2
    MyDockerfile

Both projects targets linux containers.

For WebApp2 additionally I updated csproj with <DockerfileFile>.\MyDockerfile</DockerfileFile> and docker-compose.override.yml with dockerfile: WebApp2/MyDockerfile because I do not use default docker file name. Such configuration works fine - I can run it and debug it.

When I place MyDockerfile in a subfolder CI so it looks like this

DockerInVS
  docker-compose*
  WebApp1
    Dockerfile
  WebApp2
    CI
      MyDockerfile

and I update the settings to these values <DockerfileFile>.\CI\MyDockerfile</DockerfileFile> and dockerfile: WebApp2/CI/MyDockerfile then I cannot debug WebApp2 project. Also I see that WebApp2 is run differently then WebApp1: WebApp1 has command tail -f /dev/null but WebApp2 has command dotnet WebApp2.dll. I checked in docs https://learn.microsoft.com/pl-pl/visualstudio/containers/container-build?WT.mc_id=visualstudio_containers_aka_containerfastmode&view=vs-2022#container-entry-point and it looks that dotnet webapp.dll means that debugger has not been attached.

Any ideas how to make debugging working when a docker file is placed in another folder?

0 Answers
Related