I have the following (simplified) setup using .NET Core 3.1 (same situation in .NET Framework)
Project A (a low level Tools library) references the NLog
package. The Tools package provides our custom wrapper around NLog
and exposes our logging interface.
Project A is deployed as a nuget package.
Project B references Project A.
PROBLEM: I am currently able to have using NLog
; in my C# files in project B even though NLog
is not referenced in project B. The purpose of the tools project A, is to encapsulate and hide NLog
, so ideally it should not be possible in project B to use NLog
directly.
Question: Is it possible to somehow prevent NLog
(or in general any public types in the dependencies of project A) from being visible in project B?
NOTE: I am thinking there might a way to do this using nuspec, but I coudn't find it.