ASP.NET Core: “The project doesn't know how to

2020-02-13 07:51发布

问题:

I have set up an ASP.Net Core Web application - this application runs Angular using .Net Core 2.2 -> 2.2.0-preview3. After initializing that project I thought I would have added working docker-support when clicking on "Add" -> "Docker Support" for "Linux Container" - but running this would prompt me with the following error-message:

Since I do have the option to add docker support there should be a way to run Angular in docker, right?

Docker Version: 18.09.0

回答1:

I know its late already, but it worked for me and i hope it helps.

1 - delete dockerfile present in the project

2 - then right click on the project > add > Docker support

3 - choose between widows or linux

This will recreate the dockerfile and add Microsoft.VisualStudio.Azure.Containers.Tools.Targets to your nugget dependencies. Updates will maybe be required.

4 - Run and should be just fine



回答2:

In my case a full reboot solved the problem.



回答3:

I was using VS2019 v16.1.3 and right clicked added an item and selected a Docker File. When clicking the run (Docker) button I encountered this issue. I upgraded to v16.1.5 which also restarted VS2019. Running the application using Docker then worked.



回答4:

For me, the nuget package "Microsoft.VisualStudio.Azure.Containers.Tools.Targets" hadn't been resolved. After updating it via Manage NuGet Packages, everything workes perfectly.