dotnet / core

.NET news, announcements, release notes, and more!
https://dot.net
MIT License
20.88k stars 4.89k forks source link

Problem building .net core app 2.0.x after install 2.1 RC final #1579

Closed prmces closed 6 years ago

prmces commented 6 years ago

"The project was restored using Microsoft.NETCore.App version 2.0.6, but with current settings, version 2.0.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."

This is my CsProj file:

<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <TargetFramework>netcoreapp2.0</TargetFramework>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="Microsoft.AspNet.WebApi.Client" Version="5.2.4" />
    <PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="2.0.1" />
    <PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="2.0.0" />
    <PackageReference Include="Microsoft.Extensions.Logging" Version="2.0.1" />
    <PackageReference Include="Newtonsoft.Json" Version="11.0.2" />
  </ItemGroup>

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

</Project>

I have not clue in how to fix that!!

Thanks

prmces commented 6 years ago

My Config: Visual Studio 2017 version 15.7.1 SD 2.1 RC final: dotnet-sdk-2.1.300-rc1-008673-win-x64

How to reproduce.

1) Create a new solution. Will create as version 2.0.0 2) Run Install-Package Microsoft.NETCore.App -Version 2.0.6 3) Try to build the application

prmces commented 6 years ago

After some research , I created a new file called global.json and put the sdk version inside and I could build .

{
  "sdk": {
    "version": "2.0.6"
  }
}