42

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:

enter image description here

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
4
  • Did you install Docker for windows and configure the container with Linux Container? What is your vs version? Try to update VS to latest version.
    – Edward
    Nov 29, 2018 at 6:50
  • My VS version is the latest available and I have installed and configured Docker for Windows correctly. Nov 29, 2018 at 11:14
  • FYI : If you are still facing this issue : I faced the same error today and it worked as expected after restarting Docker for Windows.
    – Akki922234
    Jan 7, 2019 at 11:38
  • In my case this solved the issue: Close the visual studio then clean the related Docker images.
    – Koray
    Aug 8, 2021 at 18:40

8 Answers 8

89

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
  • 5
    After following the steps above, I had to restart Visual Studio, then it worked. Jun 12, 2019 at 15:10
  • 1
    Thanx, I was simply missing the Microsoft.VisualStudio.Azure.Containers.Tools.Targets package Mar 23, 2023 at 6:17
24

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.

2

In my case a full reboot solved the problem.

1
  • well.. this was the only solution for me.
    – curiousBoy
    Mar 8, 2020 at 14:23
1

I needed to rebuild the solution, probably to pull in this newly referenced Nuget package in the .csproj:

<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="x.y.z" />

Restarting Visual Studio then running under Docker again was then successful.

1
  1. Check if installed Package "Microsoft.VisualStudio.Azure.Containers.Tools.Targets"
  2. The project name and the solution name should be the same, e.g. like WebApp.csproj and WebApp.sln.
0

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.

0

I had all of the sdks installed, however looking at the supported frameworks I could see that the template used netcore2.2. Even though I had it installed, I still got the error. Seeing as 2.2 has reached EndOfLife, so I changed to 2.1

No need to delete the DockerFile

Verify compatible sdk is installed

The fix for me was to change the FROM build step from 2.2 to 2.1

Updating the DockerFile

0

I had similar issues, resolved by updating NuGet packages to the latest.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.