VS 2017 references old versions even after installing Latest SDK
@Praveen-Rai commented on Sun Aug 26 2018
I was using .Net Core 2.1.1 untill now, and recently updated the SDK to 2.1.401 (.Net Core Runtime 2.1.3). When i create a new project the version of Microsoft.AspNetCore.App and Microsoft.NETCore.App under Dependencies > SDK is still 2.1.1. Looking at the properties of Dependencies > NuGet, the package is being referenced from "C:\Program Files\dotnet\sdk\NuGetFallbackFolder\microsoft.aspnetcore.app\2.1.1"
I tried installing Package 2.1.3 using NuGet package manager, and it downloaded all dependencies (v2.1.3) from NuGet despite that i have 2.1.3 already installed on my machine.
I've tried specifying the version in the .csproj file, but again it downloads from the NuGet.
I am using VS 15.7.4 on Win 10 x64. And i have following .Net Core SDKs installed on my machine : 1.1.0 , 2.0.0 , 2.1.201 , 2.1.301 , 2.1.302 , 2.1.401.
@uffebjorklund commented on Mon Aug 27 2018
We control sdk-version by having a global.json in the root of our solution.
{
"sdk": {
"version": "2.1.401"
}
}
We are on Linux and Mac (vscode), but I guess this should work when you are using Visual Studio as well.
@Praveen-Rai commented on Mon Aug 27 2018
@uffebjorklund Sorry i couldn't find global.json anywhere in my project.
@Praveen-Rai commented on Mon Aug 27 2018
I tried using RuntimeFrameworkVersion in the .csproj file. But it only updates Microsoft.NETCore.App to 2.1.3. Adding version tag to the package reference makes Nuget to download the package from the Nuget server.
@uffebjorklund commented on Mon Aug 27 2018
There is no global.json by default.. just add one and then copy paste the content from my first post
@noorrocks commented on Thu Aug 30 2018
I have also faced this issue. This is irrespective of VS 2017. I am not sure why NuGetFallbackFolder\ folder has the older version. When you issue dotnet --info command, it displays the current version.
I have also checked this after deleting the NuGetFallbackFolder. Once it's deleted, this is folder get again created at the time of dotnet new from somewhere (but don't know from where).
This is by design if you are a framework dependent application. In this case, we make your application target the lowest possible version, in this case 2.1.1. When you run in a machine that has 2.1.3 (or another higher runtime version installed), your app will actually run against the highest possible runtime available.
You should not need to re-target your application's runtime at all.
@livarcocc - cool thanks for this clarification
@Petermarcu Thanks for the redirection & @livarcocc Thanks for the clarification. How about self-contained applications ?
@Praveen-Rai self-contained apps will roll-forward in the publish time. Meaning, during publish, when you specify a runtime, we will re-restore your project for the latest runtime version we know of and publish your self-contained app for that.