I am upgrading an old VS project that was built using Sitecore 7.2. I have changed the target .NET Framework to 4.7.1. Now I am trying to install Sitecore.Kernel v9.1.1 via Nuget. However when I try to do that I get the following error:

Could not install package 'Microsoft.Extensions.DependencyInjection.Abstractions 2.1.1'. You are trying to install this package into a project that targets '.NETFramework,Version=v4.7.1', but the package does not contain any assembly references or content files that are compatible with that framework.

I have also attempted to install the Microsoft.Extensions.DependencyInjection.Abstractions package separately but I get the same error. No matter what I do I can't install Microsoft.Extensions.DependencyInjection.Abstractions. What's really strange is that if I create a brand new solution that targets .NET 4.7.1 I can install if fine. So there must be something strange in my existing project/solution that is preventing me from installing Microsoft.Extensions.DependencyInjection.Abstractions 2.1.1.

Any ideas?

  • Is all projects in the Solution has the target framework set to 4.7.1? Apr 15 '19 at 18:00
  • Yes all projects target .NET Framework 4.7.1 Apr 15 '19 at 18:09
  • Can you remove all the references and then start by adding the different nugets Apr 15 '19 at 18:09
  • Assuming you're on a recent nuget, close VS and try running nuget.exe locals -clear all. Then try installing again.
    – Mark Cassidy
    Apr 15 '19 at 20:03

The answer was to update Visual Studio from 15.0 to 15.9. Once I did that then the installation from Nuget worked. Who would have guessed. :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.