Fail to run a new ASP.NET Core solution with Docker in Visual Studio 2017

Sometimes you want to make a demo to a good friend of you about Docker support in Visual Studio 2017. So your start Visual Studio 2017, create a blank ASP.NET Core (Docker support enabled), press F5 to run the application but things are not really happening like your want. In my case, I had the following message :

The specified framework 'Microsoft.NETCore.App', version '1.1.2' was not found.
  - Check application dependencies and target a framework version installed at:
      /usr/share/dotnet/shared/Microsoft.NETCore.App
  - The following versions are installed:
      1.1.1
  - Alternatively, install the framework version '1.1.2'.

The issue comes from the fact that Visual Studio 2017 builds a project based on .NET Core 1.1.2 but your Docker image only supports .NET Core 1.1.1 '(see message). Why your image doesn’t support 1.1.2 ? Maybe simply because your image is outdated with no support for 1.1.2. So the trick is quite easy and it consists to execute the pull again the image to force Docker to update the base image :

docker pull microsoft/aspnetcore:1.1

This should solve your issue after several minutes of downloading the updated image layer.

Laisser un commentaire

Votre adresse de messagerie ne sera pas publiée. Les champs obligatoires sont indiqués avec *