dotnet / dotnet/efcore

dotnet ef dbcontext info FileLoadException

Open
#37,087 3 comments 0 reactions 1 assignee Claimed by @AndriySvyryd View on GitHub
area-tools customer-reported
Dominant language
C#
Stars
14.8k
Forks
3.4k
PR merge metrics
PR metrics pending

Description

### 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


Exe
net9.0
enable
enable



```

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](https://github.com/user-attachments/files/23358341/bug.zip)

Thank you,
Dejan

### Your code

```csharp
dotnet ef dbcontext info
```

### Stack traces

```text

```

### Verbose output

```text

```

### EF Core version

9.0.10

### Database provider

_No response_

### Target framework

.NET 9.0

### Operating system

MacOS 26.0.1

### IDE

VS Code

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.