question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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

See original GitHub issue

From @gpresland on November 19, 2018 21:38

Creating a simple project from scratch and attempting to build it throws multiple errors with SDK 2.1.500.

Create a new project with:

dotnet new webapi -o example
cd example
code

Inside Visual Studio Code run:

dotnet publish -c Release -r win10-x64

You will be spammed with errors such as:

[fail]: OmniSharp.MSBuild.ProjectLoader
        NETSDK1061: The project was restored using Microsoft.NETCore.App version 2.1.6, but with current settings, version 2.1.0 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.

Copied from original issue: dotnet/coreclr#21095

Issue Analytics

  • State:open
  • Created 5 years ago
  • Reactions:14
  • Comments:32 (10 by maintainers)

github_iconTop GitHub Comments

32reactions
gllanderascommented, Jan 29, 2019

I had similar problem, and I solved it indicating in the csproj file the version of the runtime framework to use:

<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFramework>netcoreapp2.1</TargetFramework>
    <RuntimeFrameworkVersion>2.1.5</RuntimeFrameworkVersion>
  </PropertyGroup>

</Project>

I saw the solution at: https://stackoverflow.com/questions/53720678/netsdk1061-the-project-was-restored-using-microsoft-netcore-app-version-1-0-0

23reactions
mafshincommented, Mar 30, 2019

I had the same problem with version 2.2 and 2.2.3 which is resolved by adding TargetLatestRuntimePatch in csproj as suggest here

<PropertyGroup>
  <TargetLatestRuntimePatch>true</TargetLatestRuntimePatch>
</PropertyGroup>
Read more comments on GitHub >

github_iconTop Results From Across the Web

NETSDK1061: The project was restored using Microsoft. ...
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 ...
Read more >
Started to get "This project is targeting a version of .NET ...
I'm getting this same issue with ASP.Net Core 3.1. The solution has been fine for two years and now it want's to install...
Read more >
error : NETSDK1061: The project was restored using ...
To resolve this issue, make sure the same settings are used for restore and for subsequent operations such as build or publish. Typically...
Read more >
Azure function build pipeline fails and getting error i.e. ...
I have deployed the my changes to azure function and deployed for the same but while building pipeline it fails in build solution...
Read more >
NETSDK1061: The project was restored using Microsoft ...
[Solved]-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-xamarin.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found