I have a docker file for a .NET Core project that references some library projects in the same solution.
Given that Docker does not allow copying files from outside of the parent directory (Docker: adding a file from a parent directory), I have to keep my Dockerfile outside of the executable (start up) project directory.
So, how do I use Visual Studio debugging with a Dockerfile that is not located within the executable project?
It seems that Visual Studio only works with the Docker debug profile if it can find a Dockerfile in the directory for the startup project.
When the Dockerfile is not present in the startup directory, the build error points at lines in a file named Container.targets, located at:
C:\Users<user>\.nuget\packages\microsoft.visualstudio.azure.containers.tools.targets\1.4.10\build
<Target Name="ContainerPrepareForLaunch" Condition="Exists('$(ContainerSemaphoreFilePath)')">
<PrepareForLaunch DevelopmentMode="$(ContainerDevelopmentMode)"
DevEnvDir="$(DevEnvDir)"
Dockerfiles="@(_Dockerfile)"
IntermediateOutputPath="$(ContainerIntermediateOutputPath)"
ProjectCapability="@(ProjectCapability)"
ProjectFilePath="$(MSBuildProjectFullPath)"
NuGetPackageFolders="$(NuGetPackageFolders)"
NuGetPackageRoot="$(NuGetPackageRoot)"
TargetFrameworkWithVersion ="$(TargetFramework)"
TargetPath="$(TargetPath)"
ErrorLogFilePath="$(ContainerSemaphoreFilePath)"
DockerLabelBuiltImages="$(DockerLabelBuiltImages)"
DockerImageLabel="$(DockerImageLabel)"
ProjectTypeGuids="$(ProjectTypeGuids)" />
</Target>
However I need to be able to manage the path to the Dockerfile on a per-project basis.
You can specify DockerfileFile
in your project file. The list of available recognized properties can be found here
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With