简体   繁体   中英

Visual Studio building solution does not copy dll to bin folder, but building project does

I have a visual studio 2013 update 4. I have a solution that includes multiple projects (all C#).

example:

  • -MySolution
  • -Webapi project ( references core project )
  • -core project ( regular class library, contains nuget package for EntityFramework 6.1.2 )

If I build the solution and try to exec a webapi method it fails because EntityFramework.SqlServer.dll is not in the bin folder of the webapi project.

If however I build the core project alone, EntityFramework.SqlServer.dll is copied into the bin folder of the Webapi project and everything is fine.

Is there some bug or am I doing something wrong by building the solution and expecting the same result if I had built the projects in order?

It appears to be some Nuget oddity at first blush.

Thanks in advance for any help!

"When you don't use the referenced DLL in your code at all, it will ignore the CopyLocal and won't copy it to your output directory." says the following link:

How does visual studio determine what to copy to the output directory with multi-project solutions?

Facing same problem and keeping with this hint, I made a dummy invocation in my library that referenced EntityFramework.SqlServer.dll and the issue was resolved:

string result = System.Data.Entity.SqlServer.SqlFunctions.Char(65);

May be you should also give it a try.

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