Skip to content

dotnet ef dbcontext info FileLoadException #37087

@djelovic

Description

@djelovic

Bug description

Hello,

I'm on M1 Mac with .NET 9 installed and when I try to run dotnet-ef I get a FileLoadException:

> dotnet ef dbcontext info
Build started...
Build succeeded.
Unhandled exception. System.IO.FileLoadException: Could not load file or assembly '/Users/dejan/.dotnet/tools/.store/dotnet-ef/9.0.10/dotnet-ef/9.0.10/tools/net8.0/any/tools/netcoreapp2.0/any/ef.dll'. The located assembly's manifest definition does not match the assembly reference. (0x80131040)
File name: '/Users/dejan/.dotnet/tools/.store/dotnet-ef/9.0.10/dotnet-ef/9.0.10/tools/net8.0/any/tools/netcoreapp2.0/any/ef.dll'

Everything is version 9:

> dotnet --version
9.0.100

> dotnet ef --version
Entity Framework Core .NET Command-line Tools
9.0.10

> cat ef.csproj
<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFramework>net9.0</TargetFramework>
    <ImplicitUsings>enable</ImplicitUsings>
    <Nullable>enable</Nullable>
  </PropertyGroup>
  <ItemGroup>
    <PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="9.0.10" />
  </ItemGroup>
</Project>

It seems weird that it's a 9.0.10 dotnet-ef but the DLL is in the net8.0 path.

Here are the contents of my directory:

bug.zip

Thank you,
Dejan

Your code

dotnet ef dbcontext info

Stack traces


Verbose output


EF Core version

9.0.10

Database provider

No response

Target framework

.NET 9.0

Operating system

MacOS 26.0.1

IDE

VS Code

Metadata

Metadata

Assignees

Type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions