1
votes

I am currently setting up a dockerfile for .netcore buildandpush in Azure Devops for a .netcore project. I am facing the below error at the "RUN dotnet restore".

The current .NET SDK does not support targeting .NET Core 3.1.  Either target .NET Core 2.0 or lower, or use a version of the .NET SDK that supports .NET Core 3.1.

I am using the below SDK for build.

FROM microsoft/aspnetcore-build:2.0 AS build

I have tried modifying the above with the build specified , I am getting same error. 1.Should I add any task for installing .NEt core SDK in yaml file? 2.I am having one solution file and 4 csproj files. Its giving multiple dlls when I build using Visual studio.In the dockerfile I have given only the below :

ENTRYPOINT ["dotnet", "Example.dll"]

How do I pass all dlls?

1

1 Answers

1
votes

That happened to me, this is microsoft CLI tools not working properly on linux... Depending on the context, it will often ignore the environment variables. To select your version of dotnet, simply add this command before interacting with dotnet, this will force dotnet to use the proper version

dotnet new globaljson --sdk-version 2.2.401 --force

Update this command to match your dotnet version