Quantcast
Channel: Active questions tagged nuget-package - Stack Overflow
Viewing all articles
Browse latest Browse all 3067

Nuget/.NET Core, how to hide dependencies in package [duplicate]

$
0
0

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.

  1. Project A is deployed as a nuget package.

  2. 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.


Viewing all articles
Browse latest Browse all 3067

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>