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 1537
清酒与你
清酒与你 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:01

    If you use Azure DevOps, don't edit project file. Use "dotnet restore"(https://docs.microsoft.com/en-us/azure/devops/pipelines/languages/dotnet-core?view=azure-devops) instead of Nuget restore:

    Replace this:

    - task: NuGetCommand@2
      inputs:
        restoreSolution: '$(solution)'
    

    With this:

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

    I had this issue when building in Azure Devops and none of the other answers would fix it. My Build and Publish steps already had matching --runtime options.

    The fix for me turned out to be to add the following into the the .csproj file (substitute the RuntimeIdentifier with the correct one for your deployment scenario):

      <PropertyGroup>
          ...
          <RuntimeIdentifier>win-x64</RuntimeIdentifier>
      </PropertyGroup>
    
    0 讨论(0)
  • 2020-12-15 05:02

    I am on Visual Studio 2019 and this answer put me on the right path, my procedure was:

    • Uninstall all instances of Microsoft .NET Core SDK off my machine.
    • Restarted computer.
    • Installed latest version of the SDK from here.
    0 讨论(0)
  • 2020-12-15 05:03

    Check also the solution I suggested here (Using Azure Pipelines with multi targeting projects I get error NETSDK1061), maybe it works for you, too:

    - task: NuGetToolInstaller@0
      inputs:
        versionSpec: '>=4.3.0'
        checkLatest: true
    
    0 讨论(0)
  • 2020-12-15 05:04

    What solved the issue for me, was to update the default NuGet package cache 'C:\Users\.nuget\packages' used for restore by changing the parameter in msvc:

    Tools > Options > NuGet Package Manager > Package Restore > Allow NuGet to download missing package & Automatically check for missing packages during build in Visual Studio.

    0 讨论(0)
  • 2020-12-15 05:10

    Add this in the .csproj

    <PropertyGroup>
    <RuntimeFrameworkVersion>2.1.5</RuntimeFrameworkVersion>
    </PropertyGroup>
    
    0 讨论(0)
提交回复
热议问题