Open vadimt2 opened 3 weeks ago
Are you using the Container launch profile?
Did you enable container support when you created the project or are you adding a docker file later?
I have created a project with a docker support and Clicked on the "Container (Dockerfile)" - like in the first image
I'm not actually on the team that works on these tools, but my best guess would be that it's working by accident. In the Container Tools
output window, you can see the command line used to start docker. For me, I see this mount:
-v "C:\Users\amcasey\source\repos\WebApplication50\WebApplication50:/app:rw"
Since I've built locally (I believe F5 will do this, even if you're launching in a container), the mounted /app
directory contains a bin
directory. I suspect that dotnet
is invoked in such a way that it discovers the pre-built binaries in bin
and runs those.
Edit: maybe it's not an accident. The docs say that the base
target is used for Debug builds and the final
target is used for other (i.e. Release) builds.
@vadimt2 FYI the best place to get support for the container tools is https://github.com/microsoft/DockerTools/issues
But while I'm here, as @amcasey said the default behavior in the container tools is to not build the entire image, instead using volume mounts to make for a faster F5 experience. If you prefer having the entire Dockerfile built for each F5, you can set the MSBuild property <ContainerDevelopmentMode>Regular</ContainerDevelopmentMode>
in your project
Is there an existing issue for this?
Describe the bug
visual studio is ignoring the Docker file
Expected Behavior
when you click on the play button, it should run copy and etc. but all the code is comment and it's still running, it doesn't event restoring the nugets -> when you build docker with cmd it's working!
Steps To Reproduce
Use the latest vs 2022 create a docker file simillar to:
and run
Exceptions (if any)
No response
.NET Version
8
Anything else?
No response