简体   繁体   中英

Referenced project dependencies DLL are not being copied

My project solution is currently having three projects:

  1. MyProject , which is my main startup project (using .NET Framework 4.7 ) - WPF, UI specfic,
  2. MyProject.Core - class library ( .NET Standard 2.0 ) - holding the models, and all of the 'behind the scenes' data
  3. MyProject.Relational - class library ( .NET Standard 2.0 ) - responsible for processing and saving the database specific informations

Project 1 (main) has set a reference to project 2 and 3 .

For the project 3 I have installed a NuGet dependency of Microsoft.EntityFrameworkCore.Sqlite (2.0.3) .

Now, when I finally want to make use of project 3 and call it's method, the following exception is being thrown:

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

This, of course is a missing DLL file - no entity framework DLL's are being copied to the app Debug directory.

Why is that ? Is this intended behaviour? Do I have to install the dependency of Microsoft.EntityFrameworkCore.Sqlite for project 1 as well? Pretty pointless to me, referencing the same dependency to project that is making no use of it.

What have I tried:

Using Visual Studio 2017.

Solved this by adding the following line into my .csproj file:

<RestoreProjectStyle>PackageReference</RestoreProjectStyle>

Specifically to the PropertyGroup group.

Not sure why it makes such difference, if anyone could explain and post in the comment it would be great. Any additional informations I will add to this answer.

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