I\'m trying to create a deployment pipeline to deploy my image to Kubernetes cluster. The first step in this process is to create an image based on the docker file. The docker
This problem is arise when you generate the Docker support via Visual Studio (v16.3.9 at least) and you are using this generated project in the Azure Pipeline with the predefined Docker pipeline template either in old-fashioned everything-to-click way so called the classic editor or the new 4-step easy-to-click way so called the modern editor.
The change in the generated file from
COPY ["DockerTest/DockerTest.csproj", "DockerTest/"]
to
COPY ["DockerTest.csproj", "DockerTest/"]
solve the problem with the Azure Pipeline but it will break your local build within the Visual Studio.
Adding
buildContext: '$(Build.Repository.LocalPath)'
to the YAML file which has been generated by the modern editor will break the build task. The template which is used in the modern editor relies on the default build context and the parser will not recognise the buildContext
command.
Only possible way how to fix this problem is to override the default build context. This override will keep the build functionality either in Visual Studio or the Azure Pipeline.
The build context can be overridden in the build image task in the classic editor.