MicrosoftLearning/eShopOnWeb

App targeting .Net 6 vs Packages targeting .Net 7

Closed this issue · 3 comments

Getting the main and trying to run the docker-compose build command produces this:

image

As .Net 7 has gone prod a few days ago, it seems some referenced packages have been upgraded but the target .Net version has not.

> docker-compose build
[+] Building 10.9s (20/25)
 => [eshoppublicapi internal] load build definition from Dockerfile                                                                                                                                                                    0.0s
 => => transferring dockerfile: 777B                                                                                                                                                                                                   0.0s
 => [eshopwebmvc internal] load build definition from Dockerfile                                                                                                                                                                       0.0s
 => => transferring dockerfile: 762B                                                                                                                                                                                                   0.0s
 => [eshoppublicapi internal] load .dockerignore                                                                                                                                                                                       0.0s
 => => transferring context: 34B                                                                                                                                                                                                       0.0s
 => [eshopwebmvc internal] load .dockerignore                                                                                                                                                                                          0.0s
 => => transferring context: 34B                                                                                                                                                                                                       0.0s
 => [eshoppublicapi internal] load metadata for mcr.microsoft.com/dotnet/sdk:6.0                                                                                                                                                       0.1s
 => [eshopwebmvc internal] load metadata for mcr.microsoft.com/dotnet/aspnet:6.0                                                                                                                                                       0.1s
 => [eshopwebmvc runtime 1/3] FROM mcr.microsoft.com/dotnet/aspnet:6.0@sha256:503e677aba012b6a4516d054135669ee6074111da5ce1dd0e2847027b2c78a3b                                                                                         0.0s
 => [eshopwebmvc internal] load build context                                                                                                                                                                                          0.8s
 => => transferring context: 7.38MB                                                                                                                                                                                                    0.8s
 => [eshopwebmvc build 1/7] FROM mcr.microsoft.com/dotnet/sdk:6.0@sha256:3dfedfc30f95c93c3e1d41a2d376f4d3d6fef665888859b616c3b46dde695b73                                                                                              0.0s
 => CACHED [eshopwebmvc runtime 2/3] WORKDIR /app                                                                                                                                                                                      0.0s
 => CACHED [eshoppublicapi final 1/2] WORKDIR /app                                                                                                                                                                                     0.0s
 => [eshoppublicapi internal] load build context                                                                                                                                                                                       0.8s
 => => transferring context: 7.38MB                                                                                                                                                                                                    0.8s
 => CACHED [eshopwebmvc build 2/7] WORKDIR /app                                                                                                                                                                                        0.0s
 => [eshoppublicapi build 3/6] COPY . .                                                                                                                                                                                                2.0s
 => CACHED [eshopwebmvc build 3/7] COPY *.sln .                                                                                                                                                                                        0.0s
 => [eshopwebmvc build 4/7] COPY . .                                                                                                                                                                                                   2.0s
 => [eshoppublicapi build 4/6] WORKDIR /app/src/PublicApi                                                                                                                                                                              0.0s
 => [eshopwebmvc build 5/7] WORKDIR /app/src/Web                                                                                                                                                                                       0.0s
 => ERROR [eshopwebmvc build 6/7] RUN dotnet restore                                                                                                                                                                                   7.8s
 => ERROR [eshoppublicapi build 5/6] RUN dotnet restore                                                                                                                                                                                7.8s
------
 > [eshopwebmvc build 6/7] RUN dotnet restore:
#0 1.092   Determining projects to restore...
#0 3.769   Restored /app/src/BlazorShared/BlazorShared.csproj (in 2.08 sec).
#0 5.498   Restored /app/src/ApplicationCore/ApplicationCore.csproj (in 3.82 sec).
#0 6.468   Restored /app/src/Infrastructure/Infrastructure.csproj (in 4.79 sec).
#0 6.661   Restored /app/src/BlazorAdmin/BlazorAdmin.csproj (in 4.98 sec).
#0 7.659 /app/src/Web/Web.csproj : error NU1202: Package Microsoft.AspNetCore.Authentication.JwtBearer 7.0.0 is not compatible with net6.0 (.NETCoreApp,Version=v6.0). Package Microsoft.AspNetCore.Authentication.JwtBearer 7.0.0 supports: net7.0 (.NETCoreApp,Version=v7.0)
#0 7.674   Failed to restore /app/src/Web/Web.csproj (in 5.99 sec).
------
------
 > [eshoppublicapi build 5/6] RUN dotnet restore:
#0 1.021   Determining projects to restore...
#0 4.001   Restored /app/src/BlazorShared/BlazorShared.csproj (in 2.38 sec).
#0 5.680   Restored /app/src/ApplicationCore/ApplicationCore.csproj (in 4.07 sec).
#0 6.048   Restored /app/src/Infrastructure/Infrastructure.csproj (in 4.44 sec).
#0 7.515 /app/src/PublicApi/PublicApi.csproj : error NU1202: Package Microsoft.AspNetCore.Authentication.JwtBearer 7.0.0 is not compatible with net6.0 (.NETCoreApp,Version=v6.0). Package Microsoft.AspNetCore.Authentication.JwtBearer 7.0.0 supports: net7.0 (.NETCoreApp,Version=v7.0)
#0 7.527   Failed to restore /app/src/PublicApi/PublicApi.csproj (in 5.91 sec).
------
failed to solve: executor failed running [/bin/sh -c dotnet restore]: exit code: 1

By the way, the original eShopOnWeb seems to be OK with no Package version issue

I confirm. @LuizMacedo Pull Requests 9 to 14 should be reverted as they upgraded packages to version 7.

It's reverted. It should be ok now. Thanks!