Closed kicaj29 closed 1 year ago
@kicaj29 Sorry for the slow response, this is currently the specified behavior for how the .dcproj connects services to projects for debugging. We do have an item on our backlog to revisit making this more flexible, but I don't have a timeline for when this may change.
Possible duplicate of #343
@kicaj29 Visual Studio 2022 17.5 Preview 2 now allows for specifying the label com.microsoft.visual-studio.project-name
on a service to specify the associated project. For instance:
webapplication2:
image: ${DOCKER_REGISTRY-}webapplication2
labels:
com.microsoft.visual-studio.project-name: "WebApplication2"
build:
context: .
dockerfile: WebApplication2/Sub/Dockerfile
Allows for debugging WebApplication2 even though the Dockerfile is in a subfolder.
Note: the label can only be set in docker-compose.yml or docker-compose.override.yml
Hi @kicaj29, After install Visual Studio 2022 17.5 Preview 6.0, I get a error when I try to open Manager Docker Compose Launch Settings:
Any idea? Thank you in advance
Hi @GeovaneBelisario , can you please create a new issue with steps to reproduce the issue you are seeing. thanks!
This still seems to be an issue with Version 17.6.0 Preview 1.0. I had an existing project and was working fine with compose and now this. Funny thing it, the identity team told me to move to the latest preview and identity nuget because managed identities don't work when using a linux box for local development. Just can't win!!! Any thoughts?
This is where the error takes you for what it's worth.
And then the compose manager -
@BC89 Can you provide an example of your compose file? Based on internal prodding the only case where we see this happening is when something like a label is repeated in a service.
Compose:
`version: '3.4'
services: marketplace: image: ${DOCKER_REGISTRY-}marketplace build: context: . dockerfile: Api/Presentation/Dockerfile
marketplace-dapr: image: "daprio/daprd:latest" depends_on:
marketplace network_mode: "service:marketplace"
roboflat: image: ${DOCKER_REGISTRY-}roboflat build: context: . dockerfile: Models/RoboFlat/Presentation/Dockerfile
roboflat-dapr: image: "daprio/daprd:latest" depends_on:
roboflat network_mode: "service:roboflat"
gassendout: image: ${DOCKER_REGISTRY-}gassendout build: context: . dockerfile: Models/GasSendout/Presentation/Dockerfile
gassendout-dapr: image: "daprio/daprd:latest" depends_on:
gassendout network_mode: "service:gassendout"
email: image: ${DOCKER_REGISTRY-}email build: context: . dockerfile: Services/Email/Dockerfile
email-dapr: image: "daprio/daprd:latest" depends_on:
Override:
`version: '3.4'
services:
marketplace: environment:
"50002:50001"
marketplace-dapr: command: ["./daprd", "-app-id", "marketplace", "-app-port", "80", "-components-path", "/components", "-config", "/configuration/marketplace-config.yaml"] volumes:
"./dapr/configuration/:/configuration"
roboflat: environment:
"50003:50001"
roboflat-dapr: command: ["./daprd", "-app-id", "roboflat", "-app-port", "80", "-components-path", "/components", "-config", "/configuration/marketplace-config.yaml"] volumes:
"./dapr/configuration/:/configuration"
gassendout: environment:
"50004:50001"
gassendout-dapr: command: ["./daprd", "-app-id", "gassendout", "-app-port", "80", "-components-path", "/components", "-config", "/configuration/marketplace-config.yaml"] volumes:
"./dapr/configuration/:/configuration"
email: environment:
"50005:50001"
email-dapr: command: ["./daprd", "-app-id", "email", "-app-port", "80", "-components-path", "/components", "-config", "/configuration/marketplace-config.yaml"] volumes:
Thanks!
@BC89 both of those files parse clean... And I can't repro this with any of my local projects. Any chance there is a stack trace for the exception in the output? If not, can you attach a debugger to VS and enable a 1st chance exception for ArgumentException to get a call stack?
It seems to me after monkeying around that the issue is in the sln and has to do with nested folders and projects. However, it's the same sln that worked fine prior to the preview upgrade.
Get Outlook for Androidhttps://aka.ms/AAb9ysg
From: Nathan Carlson @.> Sent: Wednesday, February 22, 2023 8:42:33 PM To: microsoft/DockerTools @.> Cc: Brendan Carroll @.>; Mention @.> Subject: [External Email] Re: [microsoft/DockerTools] VisualStudio 2022 - docker compose - debugging does not work when dockerfile is not in default location (Issue #355)
From @. 410-316-7820 This is an External Email from outside of KCI.
@BC89 both of those files parse clean... And I can't repro this with any of my local projects. Any chance there is a stack trace for the exception in the output? If not, can you attach a debugger to VS and enable a 1st chance exception for ArgumentException to get a call stack?
— Reply to this email directly, view it on GitHubhttps://github.com/microsoft/DockerTools/issues/355#issuecomment-1441118326, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AAZFIM7BDMINEGIDY7QTSQLWY26ATANCNFSM6AAAAAAQQ26EWY. You are receiving this because you were mentioned.Message ID: @.***>
@BC89 looking at all of the dictionary calls, the only other interesting things to check: Do you have any projects with the same filename or in the same folder?
Not in the same folder but in the solution and that appears to be the culprit is odd because the dll and namespaces are different.
Get Outlook for Androidhttps://aka.ms/AAb9ysg
From: Nathan Carlson @.> Sent: Wednesday, February 22, 2023 10:20:50 PM To: microsoft/DockerTools @.> Cc: Brendan Carroll @.>; Mention @.> Subject: [External Email] Re: [microsoft/DockerTools] VisualStudio 2022 - docker compose - debugging does not work when dockerfile is not in default location (Issue #355)
From @. 410-316-7820 This is an External Email from outside of KCI.
@BC89 looking at all of the dictionary calls, the only other interesting things to check: Do you have and projects with the same filename or in the same folder?
— Reply to this email directly, view it on GitHubhttps://github.com/microsoft/DockerTools/issues/355#issuecomment-1441168024, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AAZFIM3ZL2B3GIR5TDYZQDDWY3JRFANCNFSM6AAAAAAQQ26EWY. You are receiving this because you were mentioned.Message ID: @.***>
@BC89 for clarification, you have multiple projects with the same filename in the solution?
That is correct. Under different folders with different namespaces but yes.
Get Outlook for Androidhttps://aka.ms/AAb9ysg
From: Nathan Carlson @.> Sent: Wednesday, February 22, 2023 11:32:42 PM To: microsoft/DockerTools @.> Cc: Brendan Carroll @.>; Mention @.> Subject: [External Email] Re: [microsoft/DockerTools] VisualStudio 2022 - docker compose - debugging does not work when dockerfile is not in default location (Issue #355)
From @. 410-316-7820 This is an External Email from outside of KCI.
@BC89 for clarification, you have multiple projects with the same filename in the solution?
— Reply to this email directly, view it on GitHubhttps://github.com/microsoft/DockerTools/issues/355#issuecomment-1441205471, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AAZFIM7VDJ6EYIUDZ3AOS3LWY3R6VANCNFSM6AAAAAAQQ26EWY. You are receiving this because you were mentioned.Message ID: @.***>
That appears to be an issue with this version of vs. I renamed and reworked the structure a bit and now the compose is working. So looks like a regression. Thank you for assisting. Much appreciated.
Get Outlook for Androidhttps://aka.ms/AAb9ysg
From: Brendan Carroll @.> Sent: Wednesday, February 22, 2023 11:54:29 PM To: microsoft/DockerTools @.>; microsoft/DockerTools @.> Cc: Mention @.> Subject: Re: [External Email] Re: [microsoft/DockerTools] VisualStudio 2022 - docker compose - debugging does not work when dockerfile is not in default location (Issue #355)
That is correct. Under different folders with different namespaces but yes.
Get Outlook for Androidhttps://aka.ms/AAb9ysg
From: Nathan Carlson @.> Sent: Wednesday, February 22, 2023 11:32:42 PM To: microsoft/DockerTools @.> Cc: Brendan Carroll @.>; Mention @.> Subject: [External Email] Re: [microsoft/DockerTools] VisualStudio 2022 - docker compose - debugging does not work when dockerfile is not in default location (Issue #355)
From @. 410-316-7820 This is an External Email from outside of KCI.
@BC89 for clarification, you have multiple projects with the same filename in the solution?
— Reply to this email directly, view it on GitHubhttps://github.com/microsoft/DockerTools/issues/355#issuecomment-1441205471, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AAZFIM7VDJ6EYIUDZ3AOS3LWY3R6VANCNFSM6AAAAAAQQ26EWY. You are receiving this because you were mentioned.Message ID: @.***>
Going to close this issue as the original issue was fixed in 17.5. The new bug with duplicate project files names is being tracked under #371
Hi, there is no mention of "com.microsoft.visual-studio.project-name" in the official documentation here: https://learn.microsoft.com/en-us/visualstudio/containers/docker-compose-properties?view=vs-2022 Might it have been put somewhere else?
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:
Both projects targets linux containers.
For WebApp2 additionally I updated csproj with
<DockerfileFile>.\MyDockerfile</DockerfileFile>
and docker-compose.override.yml withdockerfile: WebApp2/MyDockerfile
because I do not use default docker file name. Such configuration works fine - I can run it and debug it.The bug
When I place MyDockerfile in a subfolder CI so it looks like this
and I update the settings to these values
<DockerfileFile>.\CI\MyDockerfile</DockerfileFile>
anddockerfile: WebApp2/CI/MyDockerfile
then I cannot debug WebApp2 project. Also I see that WebApp2 is run differently then WebApp1: WebApp1 has commandtail -f /dev/null
but WebApp2 has commanddotnet 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?
Docs https://learn.microsoft.com/en-us/visualstudio/containers/container-msbuild-properties?view=vs-2022 say that
DockerfileFile
setting can be also a path: "Describes the default Dockerfile that will be used to build/run the container for the project. This can be a path as well."