#SharePointProblems | Koskila.net

Solutions are worthless unless shared! Antti K. Koskela's Personal Professional Blog

Errors loading an assembly that's using Microsoft Graph API

koskila
Reading Time 3 min
Word Count 403 words
Comments 2 comments
Rating 5 (1 votes)
View

Man, do I run into all kinds of issues with the smallest Azure Functions that I develop. And it's mostly my fault.

The silver lining is that you're here to read this article, so you probably ran into this same stuff. Well - you should be happy to hear that this article describes fixes to a couple of issues - let's see if they help you out as well!

The article probably largely applies to any situation where you have a project referencing another project and trying to figure out the dependencies during runtime, but I have mostly encountered these

Problem

There are a couple of different errors you might get. Let me try to list some examples. I ran into each of these...

The one I got first was this:

System.IO.FileNotFoundException: 'Could not load file or assembly 'Microsoft.Extensions.Configuration, Version=5.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'. The system cannot find the file specified.
System.IO.FileNotFoundException: 'Could not load file or assembly 'Microsoft.Extensions.Configuration.Abstractions, Version=5.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'. The system cannot find the file specified.

Or a similar one for a different assembly:

System.IO.FileNotFoundException: 'Could not load file or assembly 'System.Text.Encodings.Web, Version=5.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. The system cannot find the file specified.

Or even this one:

A host error has occurred during startup operation '[guid]'.
[2021-09-23T09:01:27.488Z] Microsoft.Azure.WebJobs.Extensions.CosmosDB: Method not found: 'Microsoft.Azure.WebJobs.IWebJobsExtensionBuilder Microsoft.Azure.WebJobs.WebJobsExtensionBuilderExtensions.ConfigureOptions(Microsoft.Azure.WebJobs.IWebJobsExtensionBuilder, System.Action`3)'.
Value cannot be null. (Parameter 'provider')

(The last one was fixed by steps 1 & 2)


And then - what do you do to fix them?

Solutions

Time needed: 15 minutes.

How do you fix different "Could not load file or assembly" errors when building a solution with multiple projects referencing one another?

  1. Add PackageReference to your referencing project

    This is caused by a referenced project's PackageReferences not swimming downstream to your referencing project. Simply add the same PackageReference node to the referencing project.

    Didn't work? Ok, let's go on...

  2. Downgrade your packages

    For me, downgrading the Microsoft.Extensions.Configuration and Microsoft.Extensions.Configuration.Abstractions packages to version 2.1.0 in both projects (referenced and referencing - in my case a class library, and the Azure Function project referencing it), actually helped.

    Well, it helped for a week, until I ran into the next issue...

  3. Disable the automated (and buggy) output cleaning step

    This step might help you if the build for your Azure Functions project is the one throwing the error!

    Add this line:

    <_FunctionsSkipCleanOutput>true</_FunctionsSkipCleanOutput>

    To your .csproj file. It'll disable some (apparently buggy) output folder cleaning from your Azure Functions build.

    This image has an empty alt attribute; its file name is image-4.png


References

Comments

Interactive comments not implemented yet. Showing legacy comments migrated from WordPress.
Dmytro
2021-12-22 11:22:19)
You saved my day! Thanks!!! I was hitting the wall with Dataverse client for two days. Step 3 perfectly works for me
Antti K. Koskela
2021-12-29 16:17:41
Thanks for your comment, Dmytro! Happy to hear it worked for you :)
Whitewater Magpie Ltd.
© 2025
Static Site Generation timestamp: 2025-08-21T07:25:10Z