#StackBounty: #c# #dll #dependencies How to set EF6 dependencies when I use .NET Standard 2.0 dll libraries with console aplication .NE…

Bounty: 250

I can’t figure out how should I set up dependencies (where to add EntityFramework nuget packages) in this scenario:

  1. Core.Persistence project which compiles to .NET Standard 2.0 dll library. I have Entity Framework 6, database entity classes for EF, DbContext etc. It is supposed to depend just on EntityFrameworkCore.

  2. Core.Domain project which also compiles to .NET Standard 2.0 dll library. I want to put my bussiness object POCO classes here. This is supposed to have no dependencies.

  3. Core.Application project, this is .NET Standard 2.0 dll library. I have all application logic here. It depends on Core.Persistence because it makes database queries and Core.Domain because it produces bussiness objects from query results.

  4. Client.ConsoleClient project. It makes .NET Framework 4.7.2 executable. It is supposed to depend only on Core.Application, BUT I HAVE PROBLEM HERE.

  5. Client.WindowsClient project which I don’t want to focus in this question.

So, this is what I have done:

enter image description here

The problem is, that I’m getting System.IO.FileLoadException when I try to call method from Core.Application.

It says that it cannot find System.Interactive.Async file (which is dependency of EntityFrameworkCore). After I add this file as dependency – there are other System.IO.FileLoadException errors.

So, temporarily I have added EF6 Core nuget package to my Client.ConsoleClient, and problems with System.IO.FileLoadException are gone, but I feel I’m doing something wrong.

At this moment I figured out, that Visual Studio is not copying dll files from Core.xxx projects outputs into Client.ConsoleClient project output, and thats why I’m getting errors.

The final question is: how to fix this properly?

Get this bounty!!!

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.