Fix for Cannot find runtime target for Framework .NETCoreApp=v1

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.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s