I have a timer job where I need to update some information in a database. The DbContext is implemented in an external assembly, using EFCore. When I run the timer job, I get the following exception:

The Execute method of job definition MyTimerJob (ID 7fc1c5a7-4965-49ff-844d-84a274f6873c) threw an exception. More information is included below. Could not load file or assembly 'Microsoft.Extensions.DependencyInjection.Abstractions, Version=, Culture=neutral, PublicKeyToken=adb9793829ddae60' or one of its dependencies. The system cannot find the file specified.

I see this was a common issue. However, I am not sure how to fix this in my scenario. The file is in the GAC, I have performed IISRESET and restarted the timer service, however, that did not help. Do you have any ideas on how I could fix this?


Not without some sort of proxy layer (similar to how CSOM is implemented). SharePoint Server uses the .NET Framework, not .NET Core, so the binaries are incompatible.

| improve this answer | |
  • I see, thanks for you answer. It's interesting that I can use EFCore inside a custom SPIisWebServiceApplication, implemented in a project that targets .NET Framework 4.7.2. Do you have any idea why the different behavior? Is it because the timer service is likely running on an older version of the framework? – Serban May 13 '19 at 15:26

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.