NETSDK1061: The project was restored using Microsoft.NETCore.App version 1.0.0, but with current settings, version 2.0.9 would be used instead

后端 未结 10 1538
清酒与你
清酒与你 2020-12-15 04:31

I\'m developing a mobile app and using MS App Center for CI. Yesterday the Unit Test project failed to build in App Center with the following error. I couldn\'t recreate the

相关标签:
10条回答
  • 2020-12-15 05:14

    I had this problem because I had a nuget source that was no longer existing. After removing the faulty nuget source I restored the project and everything worked.

    I restored the project via commandline:

    dotnet restore
    
    0 讨论(0)
  • 2020-12-15 05:20

    You need to set the same publish and building runtimes

    <Project Sdk="Microsoft.NET.Sdk">
      <PropertyGroup>
        <TargetFramework>netcoreapp2.1</TargetFramework>
        <RuntimeFrameworkVersion>2.1.0</RuntimeFrameworkVersion> --> fix publishing issues
        <PlatformTarget>AnyCPU</PlatformTarget> --> fix publishing issues
      </PropertyGroup>
      <ItemGroup>
        <PackageReference Update="Microsoft.NETCore.App" Version="2.1.0" /> --> fix building issues
        <ProjectReference Include="..\PublicSonar.Monitor.Persistent.Json\PublicSonar.Monitor.Persistent.Json.csproj" />
      </ItemGroup>
    </Project>
    
    0 讨论(0)
  • 2020-12-15 05:20

    Try Adding <TargetLatestRuntimePatch>true</TargetLatestRuntimePatch>to your <PropertyGroup> tag. Example :

      <PropertyGroup>
        <TargetFramework>netcoreapp2.2</TargetFramework>
        <AspNetCoreHostingModel>InProcess</AspNetCoreHostingModel>
        <TargetLatestRuntimePatch>true</TargetLatestRuntimePatch>
      </PropertyGroup>
    
    0 讨论(0)
  • 2020-12-15 05:22

    I am on Visual Studio 2019. I encountered this issue when I tried to publish my project as Self-contained for the second time.

    What I did to get rid of this error was:

    • Change the Deployment Mode to Framework Dependent
    • Publish the project
    • Change it back to Self-contained and published again

    It seemed to be caused by some faulty cache that can be cleared by switching to a different deployment mode.

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