Solving issues with adding Sitecore.Kernel 9.3 nuget into ASP.NET project

Reading Time: < 1 minute

We were setting up new Sitecore 9.3 solution and my colleague created standard Blank ASP.NET Web project as we are used to following official Sitecore documentation.

When he tried to add Sitecore.Kernel via NuGet into the project, it failed with this error:

Failed to add reference. The package ‘Microsoft.AspNet.WebApi.Client’ tried to add a framework reference to ‘System.Net.Http’ which was not found in the GAC. This is possibly a bug in the package. Please contact the package owners for assistance. Reference unavailable.

Kind of strange we first thought.

Then we looked into package manager log where we saw that after “Microsoft.AspNet.WebApi.Client” package was installed (all it tried to install it), there was some clash with NewtonSoft.Json between versions 6 and 11 and it reverted all Nuget packages previously installed.

Long story short:

We had to change version of Microsoft.CodeDom.Providers.DotNetCompilerPlatform nuget package OOTB configured for the project. Problem was with version 2.0.0. When we changed it to version 1.0.7 it started to work. We have removed all previous references of version 2.0.0 also from various places in csproj file (like <Import …> and <Error Condition…> elements) and it went through afterwards.

For the rest of the things when setting up solution / project for Sitecore 9.3, visit this documentation article.

Happy sitecoring!

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.