Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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 issue on any developer machine, this error only occours in App Center.

error : 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. To resolve this issue, make sure the same settings are used for restore and for subsequent operations such as build or publish. Typically this issue can occur if the RuntimeIdentifier property is set during build or publish but not during restore. For more information, see https://aka.ms/dotnet-runtime-patch-selection. 

Their paid support just give the basics, clean the project, roll back my last commit ect. Has anyone come into this issue before on App Center?

like image 510
Chris Sewell Avatar asked Dec 11 '18 09:12

Chris Sewell


2 Answers

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> 
like image 150
Pavlo Datsiuk Avatar answered Sep 25 '22 14:09

Pavlo Datsiuk


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 
like image 26
Quốc Ngô Đức Avatar answered Sep 23 '22 14:09

Quốc Ngô Đức