Build error of ASP.NET Core - “…current settings, version 2.1.0-preview3-26411-06 would be used instead”

后端 未结 10 1414
南方客
南方客 2021-02-07 20:18

I\'ve created a sample project using dotnet, but I get the following error when building the project:

error : The project was restored using Mic

相关标签:
10条回答
  • 2021-02-07 21:00

    I experienced the same:

    The project was restored using Microsoft.NETCore.App version 2.1.2, but with current settings, version 2.1.0 would be used instead.

    Removing the explicitly set --self-contained false from the dotnet publish command seemed to do the trick for us. It defaults to the same, so why it makes a difference, I have no idea.

    This was with SDK version 2.1.400.

    0 讨论(0)
  • 2021-02-07 21:02

    I’ve installed .NET SDK 2.2.0 and found out that this isn't the correct version and the correct one was renamed to 2.1.300 to be in sync with the .NET Core application whose the last version is 2.1.0. I installed 2.1.300 and everything runs correctly.

    0 讨论(0)
  • 2021-02-07 21:04

    In my case, in the .csproj file I changed

    <ItemGroup>
        <PackageReference Update="Microsoft.NETCore.App" Version="2.0.5" />
    </ItemGroup>
    

    to:

    <ItemGroup>
        <PackageReference Update="Microsoft.NETCore.App" Version="2.1.0" />
    </ItemGroup>
    

    And it worked.

    0 讨论(0)
  • 2021-02-07 21:04

    In my case the issue was fixed by ensuring I had two projects, with one depending on the other.

    One project had a RuntimeIdentifier specified in the .csproj file, but the other did not. Once I ensured both had matching RuntimeIdentifiers, the problem was fixed.

    0 讨论(0)
提交回复
热议问题