首页 > 解决方案 > 错误是说 dotnetcore 3.0 SDK 不支持 netstandard 2.1

问题描述

我正在使用 RUN 步骤进行 docker 构建,该步骤执行dotnet publish. 该错误似乎表明 dotnetcore 3.0 不支持 netstandard2.1(根据https://docs.microsoft.com/en-us/dotnet/standard/net-standard是不正确的)。

为什么我会收到此错误?

$ docker build -t Blah/api -f ./Blah.Api/Dockerfile --build-arg Blah_version=0.0.0 --build-arg Blah_build_num=${buildNum} .
Sending build context to Docker daemon  32.78MB

Step 1/14 : FROM microsoft/dotnet:3.0-sdk AS build-env
 ---> a4b0ceb74bae
...
...
Step 6/14 : RUN dotnet restore ./Blah.Api/Blah.Api.csproj  && dotnet publish ./Blah.Api/Blah.Api.csproj --no-restore --configuration=Release --framework=netcoreapp3.0 /p:AssemblyVersion=${Blah_version}.${Blah_build_num} --output=/app/out
 ---> Running in e1f8563f8bf3
/usr/share/dotnet/sdk/3.0.100-preview-010184/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.TargetFrameworkInference.targets(155,5): error NETSDK1045: The current .NET SDK does not support targeting .NET Standard 2.1.  Either target .NET Standard 2.0 or lower, or use a version of the .NET SDK that supports .NET Standard 2.1. [/app/Blah.Integration.Chains/Blah.Integration.Chains.csproj]

标签: .net.net-coredotnet-publish

解决方案


推荐阅读