Paul
Paul

Reputation: 3283

Type not found Microsoft.EntityFrameworkCore in .NET Standard project

I am having a total nightmare getting Entity Framework Core working in my .NET standard project! I am using .NET Standard 2

I can install the package fine (Microsoft.EntityFrameworkCore.SqlServer)

However, when I build my application although it compiles, I get the error below

Could not load file or assembly 'Microsoft.EntityFrameworkCore, Version=2.0.1.0, Culture=neutral, PublicKeyToken=adb9793829ddae60' or one of its dependencies. The system cannot find the file specified.

Has anyone ever had this? I wasnt expecting this to be such a pain just to use Entity Framework in .NET Standard lol

I cant see any dlls related to this in my output folders

My application is hosted within service fabric, but I am not sure thats anything to do with it

Paul

Upvotes: 0

Views: 983

Answers (2)

Evgeny Bychkov
Evgeny Bychkov

Reputation: 332

Try to add this into your .csproj file which contains reference to the

Microsoft.EntityFrameworkCore.SqlServer

<PropertyGroup>
  <AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
  <GenerateBindingRedirectsOutputType>true</GenerateBindingRedirectsOutputType>
  <CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
</PropertyGroup>

Upvotes: 0

Paul
Paul

Reputation: 3283

I am assuming there is a bug either with Nuget or Visual Studio

I ended up having to manually copy all the dlls!!

Upvotes: 0

Related Questions