How to update version of Microsoft.NETCore.App SDK in VS 2017
Asked Answered
S

3

7

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?

Socialite answered 19/7, 2017 at 23:32 Comment(0)
P
3

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.

Pragmatism answered 20/7, 2017 at 15:50 Comment(2)
@Socialite I think the version of Microsoft.NETCore.App is actually the runtime version. As you can see, if you change the RuntimeFrameworkVersion in csproj file, the version of Microsoft.NETCore.App will change accordingly. So I think 1.1.2 is correct for you. 1.0.4 is not only the version of the newest SDK, but also another runtime version for .NET Core 1.0, you can see it at github.com/dotnet/core/blob/master/release-notes/…Higginson
Yes you are correct that there is also a runtime version 1.0.4. and it is installed on my machine. Its very confusing that in VS it is listed under SDK. They should rename that folder under Dependencies as runtime or something elseSocialite
I
0

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.

Inductile answered 20/7, 2017 at 4:33 Comment(0)
R
0

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!

Ravens answered 15/2, 2021 at 2:58 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.