Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do you change Docker OS Support for a .Net Core Web Application Project?

I have a .NET Core Web Application project where I chose the incorrect OS under the "Enable Docker Support" checkbox: enter image description here

How do I change this for an existing project? And to be clear, I want to target linux, not "Switch to Windows Containers..." in docker.

like image 820
Jay Cummins Avatar asked Feb 03 '19 11:02

Jay Cummins


2 Answers

This turned out to be easy, and I did it through editing the csproj file: Changed <DockerDefaultTargetOS>Windows</DockerDefaultTargetOS> to <DockerDefaultTargetOS>Linux</DockerDefaultTargetOS> and reload.

I am still not sure where you would do this from Visual Studio (if it possible).

like image 177
Jay Cummins Avatar answered Sep 25 '22 05:09

Jay Cummins


If only one project is there in the solution, I would delete the project associated with docker-compose.dcproj and Dockerfile inside the API project. After that I would right click and again add docker support to that project.

This would create new dockerfile with linux base image.

And new dcproj will have linux mentioned

<DockerTargetOS>Linux</DockerTargetOS>
like image 43
prisar Avatar answered Sep 21 '22 05:09

prisar