sdk: The specified framework 'Microsoft.NETCore.App', version '2.1.1' was not found after the SDK is uninstalled

Steps to reproduce

You need to already have the Microsoft.NETCore.App 2.1.0 SDK installed with a web project with the versionless Microsoft.AspNetCore.App in the .csproj. <PackageReference Include="Microsoft.AspNetCore.App" />

Install the Microsoft.NETCore.App 2.1.1 SDK and debug your project. I got it from here: https://github.com/dotnet/versions/tree/7a833dddfddc27f2074b755b94234a25b9757637/build-info/dotnet/product/cli/release

Uninstall the Microsoft.NETCore.App 2.1.1 SDK.

Debug the web project again.

Expected behavior

Should run with version 2.1.0.

Actual behavior

Getting the following error message when debugging: It was not possible to find any compatible framework version The specified framework ‘Microsoft.NETCore.App’, version ‘2.1.1’ was not found. The following versions are installed: 2.1.0 at [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]

I tried with a repair on the 2.1.0 SDK, reboot, all changes are rolled back from the source control. I cannot see a reference to the 2.1.1 version anywhere. Where does it think that I should target 2.1.1 after I have uninstalled it?

Environment data

dotnet --info output: .NET Core SDK (reflecting any global.json): Version: 2.1.300 Commit: adab45bf0c

Runtime Environment: OS Name: Windows OS Version: 6.1.7601 OS Platform: Windows RID: win7-x64 Base Path: C:\Program Files\dotnet\sdk\2.1.300\

Host (useful for support): Version: 2.1.0 Commit: caa7b7e2ba

.NET Core SDKs installed: 1.0.0-preview1-002702 [C:\Program Files\dotnet\sdk] 1.0.0-preview2-003121 [C:\Program Files\dotnet\sdk] 1.0.0-preview2-003131 [C:\Program Files\dotnet\sdk] 1.0.0 [C:\Program Files\dotnet\sdk] 1.0.2 [C:\Program Files\dotnet\sdk] 1.0.3 [C:\Program Files\dotnet\sdk] 1.0.4 [C:\Program Files\dotnet\sdk] 1.1.0 [C:\Program Files\dotnet\sdk] 2.0.0 [C:\Program Files\dotnet\sdk] 2.0.2 [C:\Program Files\dotnet\sdk] 2.0.3 [C:\Program Files\dotnet\sdk] 2.1.2 [C:\Program Files\dotnet\sdk] 2.1.4 [C:\Program Files\dotnet\sdk] 2.1.100 [C:\Program Files\dotnet\sdk] 2.1.101 [C:\Program Files\dotnet\sdk] 2.1.102 [C:\Program Files\dotnet\sdk] 2.1.103 [C:\Program Files\dotnet\sdk] 2.1.104 [C:\Program Files\dotnet\sdk] 2.1.200 [C:\Program Files\dotnet\sdk] 2.1.201 [C:\Program Files\dotnet\sdk] 2.1.300 [C:\Program Files\dotnet\sdk]

.NET Core runtimes installed: Microsoft.AspNetCore.All 2.1.0 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All] Microsoft.AspNetCore.All 2.1.1 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All] Microsoft.AspNetCore.App 2.1.0 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 2.1.1 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.NETCore.App 1.0.0-rc2-3002702 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 1.0.0 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 1.0.1 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 1.0.4 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 1.0.5 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 1.1.1 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 1.1.2 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 2.0.0 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 2.0.3 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 2.0.5 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 2.0.6 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 2.0.7 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 2.1.0 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]

To install additional .NET Core runtimes or SDKs: https://aka.ms/dotnet-download

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Reactions: 1
  • Comments: 29 (13 by maintainers)

Most upvoted comments

@tstojecki how did you update the package? did the NuGet package manager offer you to update the package reference?

The idea is that you don’t specify the version of the package in the project file and let the tooling choose a version for you:

<Project Sdk="Microsoft.NET.Sdk.Web">
…
<ItemGroup>
   <!--  No Version needed -->
  <PackageReference Include="Microsoft.AspNetCore.App" />
</ItemGroup>
</Project>

looks like you have an outdated version of the base image on your machine. can you do a

docker pull microsoft/dotnet:2.1-aspnetcore-runtime

and see if it pulls a newer version? then try rebuilding your image.

I fixed it now. The .NET Core Runtime of Microsoft.AspNetCore.App 2.1.1 was still installed, so I deleted the following folder: C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App\2.1.1

The error message might be misleading. I got this when the actual error was that I just had a missing NuGet package (Microsoft.EntityFrameworkCore.Design).

alternatively, you could explicitly change your Dockerfile to use the microsoft/dotnet:2.1.1-aspnetcore-runtime image.

Usually this isn’t supposed to happen since your app would build for a .0 patch version of the runtime and the newer runtimes would light up and be used if installed on the machine / docker image. For ASP.NET Core 2.1.1, there were a few tooling related changes in the package that require to use 2.1.1 during build and thus upgrading the minimum required runtime version to 2.1.1. If all goes well, this won’t be a problem for 2.1.2 and up (you’d just be left with an image with an old runtime version in your case. but that’s an issue with docker builds without doing a docker pull as part of the build regardless of the asp.net core version)