6
votes

I have ASP.NET Core API project which was initially developed using VS 2015. I installed VS 2017 and let it convert the project.
Then i goto Project Properties -> Application ->Target framework and change the target framework to .NETCoreApp 1.1.

as soon as i do that i get 2 errors

Error One or more projects are incompatible with .NETCoreApp,Version=v1.0.

Error Project Api is not compatible with netcoreapp1.0 (.NETCoreApp,Version=v1.0). Project Api supports: netcoreapp1.1 (.NETCoreApp,Version=v1.1)

when i checked Dependencies -> SDK -> Microsoft.NETCore.App -> Properties it shows version 1.0.4 and SDK Root to C:\Users\username\.nuget\packages\microsoft.netcore.app\1.0.4

I have already installed Microsoft.NETCore.App SDK version 1.1.2 on my machine.

When i goto Nuget Package Manager to update SDK version, it shows its Autoreferenced and update button is disabled.

How do i update project's SDK's version to 1.1.2?

Also why VS studio reference SDK from C:\Users\username\.nuget\packages\microsoft.netcore.app instead of from C:\Program Files\dotnet\shared\Microsoft.NETCore.App\1.1.2

Update 1

Actually 1.1.2 is not SDK version. As of 7/20/2017 the latest SDK version is 1.0.4 and Runtime version is 1.1.2 On my machine I have C:\Program Files\dotnet\sdk\1.0.4 SDK and C:\Program Files\dotnet\shared\Microsoft.NETCore.App\1.1.2 runtime installed.

So as i mentioned erlier, when i open converted project in VS 2017, I see Dependencies -> SDK ->Microsoft.NETCore.App - Properties version is 1.0.4 and SDK Root is C:\Users\username\.nuget\packages\microsoft.netcore.app\1.0.4

Now I added new project in the same solution, however new project's Dependencies -> SDK ->Microsoft.NETCore.App -> Properties version is 1.1.2 and SDK root C:\Users\username\.nuget\packages\microsoft.netcore.app\1.1.2

I am not sure which is correct here, the SDK version of the converted project or SDK version of the newly added project?

Infact if create a brand new project in VS 2017 i see its Dependencies -> SDK ->Microsoft.NETCore.App -> Properties version is 1.1.2

1.1.2 SDK not even SDK available. Why VS 2017 shows runtime version as SDK version

is this a bug in VS 2017?

3

3 Answers

3
votes

Right click your project and edit your csproj file.

If you see a line like this:

<RuntimeFrameworkVersion>1.0.4</RuntimeFrameworkVersion>

Then update it to 1.1.2 or just remove this line. Then restore the packages (maybe using command line dotnet restore, I don't know whether VS will do this automatically).

This way you can update Microsoft.NETCore.App to 1.1.2 and this should fix your problem.

0
votes

I`d suggest you to update every of your project dependencies at least to version 1.1.0, then try to change the version once again. Make sure to clean and rebuild your solution after all.

0
votes

In my case, I had a project using .NET Core 3.1 and I wanted to update to 5.0, which is the latest version at the moment. In the csproj file, I deleted the line preceded by the minus symbol and added the line preceded by the plus symbol, as shown below 1:

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

  <PropertyGroup>
- <TargetFramework>netcoreapp3.1</TargetFramework>
+    <TargetFramework>net5.0</TargetFramework>
  </PropertyGroup>

</Project>

Then, I created a file called global.json whose content was the following:

{
  "sdk": {
    "version": "5.0.103"
  }
}

For this, I used the command: dotnet new globaljson --sdk-version 5.0.103 2

Finally, I compiled and run the application and worked!