Regarding .Net Runtime

54 views Asked by At

If my Project A has a reference to a package like NLog 2.0 and Project B, and if Project B also has a reference to NLog 1.0, then at runtime, when Project A executes Project B's functionality, will it use NLog 1.0 or NLog 2.0?

If I upgrade NLog to version 3.0 in Project B, it generates some config settings like dependentAssembly, bindingRedirection in app.config. Should I manually add those entries in Project A's app.config too?

Please help me to understand it.

1

There are 1 answers

0
Falco Alexander On

Dependency resolution is done with either

    1. PackageReference or
    1. packages.config

the first is newer and preferred and default in new projects, you should consider to change to it!

then the answer is clear:

"Direct dependency wins"

https://learn.microsoft.com/en-us/nuget/concepts/dependency-resolution