Share via

Void Microsoft.EntityFrameworkCore.Storage.RelationalTypeMapping

Anjali Agarwal 1,591 Reputation points
2026-05-01T04:39:30.9633333+00:00

I have an application that has been running successfully for several years. Recently, I upgraded the .NET framework to version 8.0, after which I started encountering the following error:

Method not found: 'Void Microsoft.EntityFrameworkCore.Storage.RelationalTypeMapping..ctor(System.String, System.Type, System.Nullable1<System.Data.DbType>, Boolean, System.Nullable1<Int32>, Boolean, System.Nullable1<Int32>, System.Nullable1<Int32>)'.

The application consists of three projects: the main application, a Models project, and a Data project.

While researching this issue, I found that it is often caused by a version mismatch in .NET or Entity Framework Core. I reviewed the .csproj files for all three projects and ensured they are targeting the same .NET version. However, the error still persists.

My main application currently has the following dependencies:

User's image

My Data project has the following dependencies:

User's image

and the Model has following dependencies:

User's image

I tried to match all the versions, but still I am getting the same error. After matching all the versions, I deleted , the obj and bin folder from each project and clean the project and rebuilt the entire solution. I am still getting the same error. This is the csproj <itemgroup> of the main project:

 <ItemGroup>
    <PackageReference Include="BitMiracle.Docotic.Pdf" Version="8.6.13474" />
  <PackageReference Include="Microsoft.AspNetCore" Version="2.3.9" />
    <PackageReference Include="Microsoft.AspNetCore.Authentication.Negotiate" Version="8.0.0" />
    <PackageReference Include="Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation" Version="8.0.0" />
  <PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="7.0.1" />
    <PackageReference Include="Microsoft.CodeAnalysis.Workspaces.Common" Version="5.0.0" />
    <PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="8.0.0">
      <PrivateAssets>all</PrivateAssets>
      <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
    </PackageReference>
    <PackageReference Include="Microsoft.Extensions.Configuration" Version="8.0.0" />
    <PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="8.0.0" />
    <PackageReference Include="System.DirectoryServices.AccountManagement" Version="8.0.1" />
    <PackageReference Include="System.DirectoryServices.Protocols" Version="8.0.0" />
    <PackageReference Include="System.IO.FileSystem" Version="4.3.0" />
  </ItemGroup>

This is csproj file of the data project:

<ItemGroup>
    <PackageReference Include="BitMiracle.Docotic.Pdf" Version="8.6.13474" />
    <PackageReference Include="Microsoft.AspNetCore" Version="2.3.9" />
    <PackageReference Include="Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation" Version="8.0.0" />
    <PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="7.0.1" />
    <PackageReference Include="Microsoft.Extensions.Configuration" Version="8.0.0" />
    <PackageReference Include="Newtonsoft.Json" Version="8.0.1" />
    <PackageReference Include="System.DirectoryServices.AccountManagement" Version="8.0.1" />
    <PackageReference Include="System.DirectoryServices.Protocols" Version="8.0.0" />
    <PackageReference Include="System.Drawing.Common" Version="8.0.1" />
    <PackageReference Include="System.IO.FileSystem" Version="4.3.0" />
  </ItemGroup>

This is the csproj of Models:

  <ItemGroup>
    <PackageReference Include="Microsoft.AspNetCore" Version="2.3.9" />
    <PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="7.0.1" />
  </ItemGroup>

Not sure, what I need to do to get rid of this error. Any help will be greatly appreciated.

Developer technologies | .NET | Entity Framework Core
0 comments No comments

Answer accepted by question author

  1. Nancy Vo (WICLOUD CORPORATION) 3,305 Reputation points Microsoft External Staff Moderator
    2026-05-01T07:49:00.1733333+00:00

    Hello @Anjali Agarwal ,

    Thanks for your question.

    1. Upgrade all EF Core packages to 8.0.0 across all projects.

    Since you've already migrated to .NET 8, you should upgrade EF Core to match. We should make sure every EF Core package has the same version. SqlServer = 7.0.1 + Tools = 8.0.0 is the hidden mismatch.

    I suggest you upgrade following packages.

    Main project:

    <PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="8.0.0" />
    <PackageReference Include="Microsoft.EntityFrameworkCore.Tools"     Version="8.0.0" />
    

    Data project:

    <PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="8.0.0" />
    

    Models Project:

    <PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="8.0.0" />
    
    1. Please clean everything again: clean -> restore -> build.
    2. Because you changed EF Core from 7 → 8, your old migrations may be incompatible, I suggest running these following commands to check if migrations exist and were generated with EF Core 7. If needed, remove and regenerate (3 final lines).
    dotnet ef migrations list
    
    dotnet ef migrations remove
    dotnet ef migrations add InitialCreate
    dotnet ef database update
    

    Note: migrations remove only removes the migration definition files, it does not delete your actual database data. Your data remains safe.

    I hope this addresses your question. If this response was helpful, please consider following the guidance to provide feedback.

    1 person found this answer helpful.

2 additional answers

Sort by: Most helpful
  1. Senthil kumar 110 Reputation points
    2026-05-01T06:34:29.28+00:00

    Hi Anjali Agarwal,

    As per my understanding. version conflict only. what are the reference having error remove and install the supported version then your issue will be resolve.

    Thanks.

    0 comments No comments

  2. Q&A Assist
    2026-05-01T04:39:48.9+00:00
    AI generated content. This question contains an answer created with AI from Q&A Assist. Learn more

    The exception indicates that at runtime EF Core is loading a different version of Microsoft.EntityFrameworkCore.Relational than the one your code (or a dependent library) was compiled against. The constructor signature of RelationalTypeMapping has changed between EF Core versions, so a version mismatch causes Method not found.

    Key points from the project files:

    • All three projects reference Microsoft.EntityFrameworkCore.SqlServer 7.0.1 (EF Core 7).
    • The main project also references Microsoft.EntityFrameworkCore.Tools 8.0.0.
    • .NET was upgraded to 8.0.

    This combination can lead to a mixed EF Core 7/8 graph at runtime (for example via transitive dependencies from Tools or other packages), so some assemblies expect EF Core 8 APIs while others still use EF Core 7.

    To fix the issue, align all EF Core packages to a single version across the entire solution and ensure no other package pulls in a conflicting EF Core version.

    Recommended steps:

    1. Choose a single EF Core major version
      • Either:
        • Upgrade everything to EF Core 8 (recommended with .NET 8), or
        • Keep everything on EF Core 7.
    2. Make EF Core versions consistent in all projects
      • If staying on EF Core 7:
        • Change Microsoft.EntityFrameworkCore.Tools in the main project to 7.0.1 (or the same 7.x version as SqlServer).
      • If upgrading to EF Core 8:
        • Change Microsoft.EntityFrameworkCore.SqlServer to 8.0.x in all three projects.
        • Ensure Microsoft.EntityFrameworkCore.Tools is also 8.0.x.
    3. Remove any stray EF Core references
      • In each .csproj, ensure there are no other Microsoft.EntityFrameworkCore.* packages at different versions.
      • If any third‑party package depends on EF Core, verify it supports the EF Core version selected.
    4. Clean and rebuild
      • Delete bin and obj for all projects again.
      • Run a full restore and rebuild of the solution.

    If the error persists after all EF Core packages are aligned to the same major/minor version, inspect the output folder for multiple versions of Microsoft.EntityFrameworkCore.* assemblies and remove or update any library that brings in the wrong version.


    References:

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.