microsoft / vscode-docker

Docker Extension for Visual Studio Code
https://marketplace.visualstudio.com/items?itemName=ms-azuretools.vscode-docker
Other
1.21k stars 515 forks source link

Fail to debug a Console project #4369

Closed v-meilei closed 1 month ago

v-meilei commented 1 month ago

OS: Mac M1/Linux Build Version: v1.29.2 Docker Desktop App Version: 4.34

Repro Steps:

  1. Create and open a .NET 9.0/8.0 Console project in VS Code, make sure it doesn't have 'launch.json' file.
  2. F5 -> Select 'Docker: Debug in Container' -> Select 'Use .NET SDK'.
  3. Check whether succeeds to debug.

Expect: Succeed to debug.

Actual: An error occurs. image

More Info: This issue doesn't reproduce when debugging .Net 9.0/8.0 MVC Project.

bwateratmsft commented 1 month ago

I am able to reproduce.

bwateratmsft commented 1 month ago

It looks like maybe the property EnableSdkContainerSupport is required to be set to true, confirming with Chet.

bwateratmsft commented 1 month ago

Ok, confirmed. For all console apps, you need to add <EnableSdkContainerSupport>true</EnableSdkContainerSupport> to a property group in the CSPROJ file. I have updated the test case instructions to note that.