microsoft / DockerTools

Tools For Docker, including Visual Studio Provisioning and Publishing
Other
175 stars 26 forks source link

StartDebugging is not present in docker compose action list and Debug doesn't work when solution and project files are on the same directory #377

Closed WeetA34 closed 1 year ago

WeetA34 commented 1 year ago

Hello

I created a fresh new project with the latest version of VS2022. I checked "Place solution and project in the same directory" during project creation. Then i added a "Container Orchestrator Support".

Two weird things:

Even if I replace StartWithoutDebugging by StartDebugging in launchSettings.json, the container debug doesn't work. Docker Compose Launch Settings Ui doesn't show the action. When I click on the dropdown, I only see:

I created another fresh new project with "Place solution and project in the same directory" not checked. Then I used the same procedure.

In this case, no issue:

I'm using:

I get the same results for docker-compose commands executed during Docker Compose Launch Settings Ui loading.

# Solution and project in the same directory
E:\testsVS\root\WebApplication1> "docker-compose" version --short
2.16.0

E:\testsVS\root\WebApplication1> "docker-compose"  -f "E:\testsVS\root\WebApplication1\docker-compose.yml" -f "E:\testsVS\root\WebApplication1\docker-compose.override.yml" -p dockercompose13158966672963815539 --ansi never --profile "*" config --services
webapplication1

# Solution and project not in the same directory
E:\testsVS\subfolder\WebApplication1> "docker-compose" version --short
2.16.0

E:\testsVS\subfolder\WebApplication1> "docker-compose"  -f "E:\testsVS\subfolder\WebApplication1\docker-compose.yml" -f "E:\testsVS\subfolder\WebApplication1\docker-compose.override.yml" -p dockercompose11554266416052497498 --ansi never --profile "*" config --services
webapplication1

Context paths are ok

# Solution and project in the same directory
E:\testsVS\root\WebApplication1> "docker-compose"  -f "E:\testsVS\root\WebApplication1\docker-compose.yml" -f "E:\testsVS\root\WebApplication1\docker-compose.override.yml" -p dockercompose13158966672963815539 --ansi never --profile "*" config
name: dockercompose13158966672963815539
services:
  webapplication1:
    build:
      context: E:\testsVS\root\WebApplication1
      dockerfile: Dockerfile
    environment:
      ASPNETCORE_ENVIRONMENT: Development
    image: webapplication1
    networks:
      default: null
    ports:
    - mode: ingress
      target: 80
      protocol: tcp
networks:
  default:
    name: dockercompose13158966672963815539_default

# Solution and project not in the same directory
E:\testsVS\subfolder\WebApplication1> "docker-compose"  -f "E:\testsVS\subfolder\WebApplication1\docker-compose.yml" -f "E:\testsVS\subfolder\WebApplication1\docker-compose.override.yml" -p dockercompose11554266416052497498 --ansi never --profile "*" config
name: dockercompose11554266416052497498
services:
  webapplication1:
    build:
      context: E:\testsVS\subfolder\WebApplication1
      dockerfile: WebApplication1/Dockerfile
    environment:
      ASPNETCORE_ENVIRONMENT: Development
    image: webapplication1
    networks:
      default: null
    ports:
    - mode: ingress
      target: 80
      protocol: tcp
networks:
  default:
    name: dockercompose11554266416052497498_default

Thank you Best Regards

patverb commented 1 year ago

@WeetA34 unfortunately compose support with a project at the solution level is not a supported scenario. The compose project currently lives at the solution level and creating a project at the solution level and adding compose support essentially creates two projects in one directory which can cause issues.

In 17.6 we have disabled the ability to add compose support to a project at the solution level to reflect this.

WeetA34 commented 1 year ago

Hello @patverb, OK. I created this issue because I didn't find any note about that. Thank you for the confirmation that it's not supported and the option to add compose will be disabled in this case