Error Could not load file or assembly 'Microsoft.Extensions.DependencyInjection, Version=,

 i had sitecore version 9.0.2 installation successfully running for about a week on development machine and all of a sudden, i did see this error


Could not load file or assembly 'Microsoft.Extensions.DependencyInjection, Version=, Culture=neutral, PublicKeyToken=adb9793829ddae60' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)


I tried few articles and follow some instructions regarding web.config validation and some assembly validations, but the error still persist.


1) Is there any way, we can resolve this error?

2) Any way, we can reset the environment?

3) Can i install another instance on same development machine with same or different version of Sitecore?


Please let me know.

  • There's an issue with auto-generated binding redirects . To work around it, add below setting in your cpsroj file (preferably before any <Import> element for a .targets file if present):

    PropertyGroup> <AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects> <GenerateBindingRedirectsOutputType>true</GenerateBindingRedirectsOutputType> </PropertyGroup>

    This should force MSBuild to create / update a YourProject.dll.config file containing the necessary binding redirects.