I’ve been working on an ASP.NET Core application; and even though I constantly say I’ll never upgrade in a Dev Cycle, I did.
I updated from .NET Core 1.0.1 to .NET Core 1.1.0, and during the upgrade path, I updated the packages in Nuget using Visual Studio, and suddenly, everything stopped working, specifically I’d get the following error when trying to build:
Can not find runtime target for framework '.NETCoreAPP, Version=v1.0' compatible with one of the target runtimes:
It turns out, Nuget modifies the project.jsonĀ file in Visual Studio in one specific crucial way: It changes what was previously:
"Microsoft.NETCore.App": { "version": "1.0.1", "type" : "platform" }
To:
"Microsoft.NETCore.App": "1.1.0",
Notice the difference? the former JSON is an object, and Nuget replaces it with a string. To fix the error, simply make that line look like the object it was previously:
"Microsoft.NETCore.App": { "version": "1.1.0", "type" : "platform" }
This error should only happen if you try to upgrade in Visual Studio.
Wow! Thank you very much! I was so confused about this error.