C# build breaks with CS7069 after moving Microsoft.Graph to version 5 or 6
Your error
error CS7069: Reference to type 'IAuthenticationProvider' claims it is defined in 'Microsoft.Graph.Core', but it could not be found1 more line it can showFix it fast
Most common cause, 1 of 2Microsoft.Identity.Web.MicrosoftGraph is still referenced
Replace the package.
dotnet remove package Microsoft.Identity.Web.MicrosoftGraph
dotnet add package Microsoft.Identity.Web.GraphServiceClient
// before (Graph 4.x helper)
var users = await _graphServiceClient.Users.Request().WithScopes("User.Read.All").GetAsync();
// after
var users = await _graphServiceClient.Users.GetAsync(b => b.Options.WithScopes("User.Read.All"));Short answer
CS7069 Reference to type IAuthenticationProvider claims it is defined in Microsoft.Graph.Core means a package compiled for Microsoft.Graph 4.x still sits in the project after Microsoft.Graph moved to 5.x or 6.x, which pull in a newer Microsoft.Graph.Core. Swap Microsoft.Identity.Web.MicrosoftGraph for Microsoft.Identity.Web.GraphServiceClient and drop the deprecated Microsoft.Graph.Auth preview.
Which cause do you have?
List every package the project resolves, including the ones pulled in by other packages. Look for Microsoft.Identity.Web.MicrosoftGraph or Microsoft.Graph.Auth next to a Microsoft.Graph of 5.0 or higher. On a .NET 9 or older SDK the verb comes first: dotnet list package.
dotnet package list --include-transitiveThen find the line you see in this list and open its fix:
- 1Microsoft.Identity.Web.MicrosoftGraph is still referenced
The list shows Microsoft.Identity.Web.MicrosoftGraph (or MicrosoftGraphBeta) and the error points at an AddMicrosoftGraph call - 2The deprecated Microsoft.Graph.Auth preview is still installed
Microsoft.Graph.Auth 1.0.0-preview appears in the list, usually with ClientCredentialProvider or similar classes in your code
What does the error look like?
error CS7069: Reference to type 'IAuthenticationProvider' claims it is defined in 'Microsoft.Graph.Core', but it could not be foundSystem.TypeLoadException: Could not load type 'Microsoft.Graph.IAuthenticationProviderOption' from assembly 'Microsoft.Graph.Core, Version=3.0.0.0
Cause 1 of 2
Microsoft.Identity.Web.MicrosoftGraph is still referenced
You seeThe list shows Microsoft.Identity.Web.MicrosoftGraph (or MicrosoftGraphBeta) and the error points at an AddMicrosoftGraph call
Check
The CS7069 IAuthenticationProvider error appears here because Microsoft.Identity.Web.MicrosoftGraph is the legacy helper built on Graph SDK 4.x; its current 4.18 release still depends on Microsoft.Graph 4.36. Its sibling, Microsoft.Identity.Web.GraphServiceClient, targets Graph SDK 5 and above.
dotnet package list | findstr /i "Identity.Web"Fix
Replace the package. AddMicrosoftGraph() keeps its name, but request modifiers such as WithScopes() and WithAppOnly() move from the old .Request() chain into the options delegate of each call.
dotnet remove package Microsoft.Identity.Web.MicrosoftGraph
dotnet add package Microsoft.Identity.Web.GraphServiceClient
// before (Graph 4.x helper)
var users = await _graphServiceClient.Users.Request().WithScopes("User.Read.All").GetAsync();
// after
var users = await _graphServiceClient.Users.GetAsync(b => b.Options.WithScopes("User.Read.All"));Verify
The project builds and a Graph call returns data; the list no longer contains the legacy helper.
dotnet buildConfirmed by raw.githubusercontent.com
Cause 2 of 2
The deprecated Microsoft.Graph.Auth preview is still installed
You seeMicrosoft.Graph.Auth 1.0.0-preview appears in the list, usually with ClientCredentialProvider or similar classes in your code
Check
Microsoft.Graph.Auth never left preview, depends on Microsoft.Graph.Core 1.25.1, and its README marks it as deprecated in favour of Azure.Identity credentials. Its providers implement the IAuthenticationProvider interface that lived in Core 1.x, a type the Core release restored for Graph 5 or 6 no longer contains.
dotnet package list | findstr /i "Graph.Auth"Fix
Remove it and give GraphServiceClient a TokenCredential from Azure.Identity, which is how the v5 upgrade guide authenticates the client.
dotnet remove package Microsoft.Graph.Auth
dotnet add package Azure.Identity
var credential = new ClientSecretCredential(tenantId, clientId, clientSecret);
var graphClient = new GraphServiceClient(credential, new[] { "https://graph.microsoft.com/.default" });Verify
The build passes and the app can read a Graph resource with the new credential.
dotnet build && dotnet runConfirmed by raw.githubusercontent.com
How do I stop it coming back?
- Upgrade Microsoft.Graph and the Microsoft.Identity.Web Graph helper in the same pull request, never one alone.
- Run dotnet package list --include-transitive in CI and fail the job if Microsoft.Graph.Auth or Microsoft.Identity.Web.MicrosoftGraph shows up beside Graph 5 or later.
- Read the Microsoft.Graph release notes before a major bump; 6.0.0 moved to Microsoft.Graph.Core 4.x and dropped net5.0.
Sources
How was this page made?
I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.
Which stack is behind this page?
Projects of mine on the same stack: Raheeb, Loade Driver, Dhero.