简体   繁体   中英

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

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

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

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>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM