Efcore: docker images for dotnet 3.0 does not have netcoreapp3.0 support

Created on 26 Sep 2019  路  11Comments  路  Source: dotnet/efcore

I get an error message when trying to run donet restore in a Dockerfile with base image microsoft/dotnet:3.0-sdk.

Steps to reproduce

docker build . with Dockerfile:

FROM microsoft/dotnet:3.0-sdk AS build
WORKDIR /src
COPY ["", "CoreProject/"]
RUN dotnet restore "CoreProject/CoreProject.csproj"

Error message:

error NU1202: Package Microsoft.EntityFrameworkCore 3.0.0 is not compatible with netcoreapp3.0 (.NETCoreApp,Version=v3.0). Package Microsoft.EntityFrameworkCore 3.0.0 supports: netstandard2.1 (.NETStandard,Version=v2.1)

Further technical details

EF Core version: 3.0.0
Database provider:
Target framework: .NET Core 3.0
Operating system: microsoft/dotnet:3.0-sdk

area-external closed-external customer-reported

All 11 comments

Sounds like you don't have the .NET Core 3.0 SDK installed locally (scratch that, I don't even Docker, Bro)

I believe this builds the project locally, then sends the binaries to the container.

But I can run dotnet restore and dotnet build locally without any problems!

I had the same problem and was able to fix it by changing this line:

FROM microsoft/dotnet:3.0-sdk AS build

to:
FROM mcr.microsoft.com/dotnet/core/sdk:3.0-buster AS build

Seems like there is a problem with the sdk in the image hosted on DockerHub. Looks like Microsoft wants us to use their mcr.microsoft.com repo anyway:
https://hub.docker.com/_/microsoft-dotnet-core-aspnet/

(and when you "Add Docker Support" for a new project in VS, you get a Dockerfile using images from that repo)

Same thing with the runtime image.
With
FROM microsoft/dotnet:3.0-aspnetcore-runtime AS base

I would get
The specified framework 'Microsoft.AspNetCore.App', version '3.0.0' was not found.

I changed it to
FROM mcr.microsoft.com/dotnet/core/aspnet:3.0 AS base

and it works fine.
It looks like the images on Docker Hub are just incorrectly tagged to 3.0.

@richlander - Is this known issue with docker & netcoreapp3.0?

cc: @Pilchie

Just to let you know I too had to deal with this error

error NU1202: Package Microsoft.EntityFrameworkCore 3.0.0 is not compatible with netcoreapp3.0 (.NETCoreApp,Version=v3.0). Package Microsoft.EntityFrameworkCore 3.0.0 supports: netstandard2.1 (.NETStandard,Version=v2.1)

In my case it was in a build pipeline created on Azure devops. In my case the Nuget agent was version 4.4.1. After some investigation i found that Visual studio 16.3 uses Nuget 5.3.0. After changing the pipeline to use Nuget 5.3.0 the problem was mitigated.

Maybe this can help others.

Thanks to hansatpm, changing the Nuget agent version solves the problem with the Nuget Restore task in Azure devops build pipeline!

@richlander Looks like maybe the tag on Docker hub is wrong here. Closing this as external, but pinging you in case it is something that needs to be followed up on.

So if it's closed here, then where do I have to open a ticket for this problem?

@brainbug89 - https://github.com/dotnet/dotnet-docker should be right place.

Was this page helpful?
0 / 5 - 0 ratings