Is it possible to make Visual Studio to copy all dependencies of referenced projects into the output path?
Example
In the Solution, Project A (Library, .NET Standard) defines some functions and is dependent on Library L1 (via NuGet) and Library L2 (local .dll
, referenced and copied to project)
Project B (Console Application) references Project A.
When building B, The output folder contains all direct dependencies of B and A.dll
. L1 and L2 are not available in the output. Therefore, the program does not work correctly.
How can I force VS to copy also L1 and L2 to the output of B?
The only way I found so far is packing A as NuGet, but this seems to be unnecessary overhead and uncomfortable. I think I am just forgetting something everyone else seems to know...
Edit (clearifying Example)
My solutions consists of two projects.
Project MongoWrapper
- .NET Standard 2.0 class Library
- depends on NuGet MongoDB.Driver package
- Actually uses this dependency (no zombie dependency)
Project ConsoleUser
- .Net Framework 4.6.1 Console Application
- References MongoWrapper project
- Actually uses MongoWrapper
Observation
When debugging the ConsoleUser
application, it compiles and starts. During runtime, when it calls a method in the MongoWrapper
which uses the MongoDB.Driver, the application crashes, as the MongoDB.Driver dependency was not copied into the output folder of the ConsoleUser
.
How to fix this?