Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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?

like image 795
LP13 Avatar asked Jul 19 '17 23:07

LP13


People also ask

How do I check my version of Netcore app?

NET Core is installed on Windows is: Press Windows + R. Type cmd. On the command prompt, type dotnet --version.

How do I change .NET SDK version?

In order to change default dotnet SDK version, place a global. json file in the current folder or any parent folder with the contents below. You can create the global. json file manually, or use the dotnet cli command dotnet new globaljson .

Does .NET Core 3.1 work with Visual Studio 2017?

Install Visual Studio NET Core 3.1 is having long term support. Visual Studio 2017 supports . NET Core 2.1, whereas Visual Studio 2019 supports both the versions.


1 Answers

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.

like image 196
胡玮文 Avatar answered Oct 05 '22 02:10

胡玮文