I have moved the docker file from *.csproj folder to .sln folder i.e., one level up. When I try to docker build using visual studio 2019, I get bellow error but same project docker build works from command prompt. Not sure what is causing visual studio 2019 to throw this error. Any help to solve this error would be helpful.
Error: No Dockerfile could be found. Please make sure you have a Dockerfile called 'Dockerfile' adjacent to the project file.
Docker build works from commands prompt :
Existing app Open the project in Visual Studio, and choose one of the following options: Select Docker Support from the Project menu. Right-click the project in Solution Explorer and select Add > Docker Support.
The Visual Studio Code Dev Containers extension lets you use a Docker container as a full-featured development environment. It allows you to open any folder inside (or mounted into) a container and take advantage of Visual Studio Code's full feature set.
Solution. In case you'd like to entirely drop Docker support, you can even delete the Dockerfile and <projectname>. csproj. user file from your project.
You can specify the path to the Dockerfile using the DockerfileFile property.
Example csproj configuration:
<PropertyGroup>
<TargetFramework>netcoreapp3.0</TargetFramework>
<UserSecretsId>secretstuff</UserSecretsId>
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
<DockerfileContext>.</DockerfileContext>
<DockerfileFile>..\Dockerfile</DockerfileFile>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
</PropertyGroup>
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