Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Could not load file or assembly Microsoft.Extensions.DependencyInjection.Abstractions in Sitecore 8.1 Project

Could not load file or assembly 'Microsoft.Extensions.DependencyInjection.Abstractions, Version=1.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60' or one of its dependencies. The system cannot find the file specified.

I tried clean and rebuild the solution and deleted bin and obj still I got same error. I'm using sitecore 8.1.

Stacktrace:

    [FileNotFoundException: Could not load file or assembly 'Microsoft.Extensions.DependencyInjection.Abstractions, Version=1.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60' or one of its dependencies. The system cannot find the file specified.]
    Sitecore.DependencyInjection.<>c__14`1.<GetRequiredResetableService>b__14_0() +0
    Sitecore.DependencyInjection.LazyResetable`1.get_Value() +148
    Sitecore.Configuration.Factory.GetConfigNode(String xpath) +72
    Sitecore.Resources.Media.UploadWatcher.InitializeIgnoreList() +156
    Sitecore.Resources.Media.UploadWatcher..cctor() +85

    [TypeInitializationException: The type initializer for 'Sitecore.Resources.Media.UploadWatcher' threw an exception.]
    Sitecore.Resources.Media.UploadWatcher..ctor() +0
like image 212
Hari24 Avatar asked Oct 30 '17 11:10

Hari24


1 Answers

This could be caused by one of the following:

  1. You added Sitecore.Kernel through Nuget package to your project, and you are referencing a later version (8.2) and its being deployed to the bin folder when you build and publish, You need to check you have the correct Sitecore.Kernel version in your nuget packages
  2. You are overwriting the web.config from your project (which does not include Sitecore default configurations) and pushing it to the root folder, You need to make sure only the correct Sitecore web.config is in your root folder.
  3. You are referencing a later version of "Microsoft.Extensions.DependencyInjection.Abstractions" package in your NuGet packages, Make sure you are referencing version number "1.0.0", as this is the version that sitecore is using.

Hope this helps

like image 180
Ahmed Okour Avatar answered Sep 30 '22 10:09

Ahmed Okour