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

C# VisualStudio dependencies for projects vs packages

$
0
0

Trying to understand where all of the dependencies of projects in a visual Studio c# solution are defined. (Edit: This is in .NetCore 3.1)

For projects in a solution dependent on other projects in the same solution, the dependency appears to be defined in the dependent project in two ways:

  1. in the project file,
  2. via a using statement or namespace prefix in source code

Yet for projects that are dependent on a NuGet package which is itself a dependent of a different project in the same solution, the dependency on the NuGet package appears to be only be explicitly defined one way:

  1. via a using statement or namespace prefix in source code

There does not appear to be any explicit dependency of the dependent project on any other project. Yet it is dependent.

A good example of this is NLog usage where NLog is defined in some init project then simple namespace references allow any project in the solution to use it.

I’ve been trying to reuse projects from other solutions and ran into this. Yes, it’s easy to catch but I’d like to understand how this all works.

My question is this: what is the rule for this type of implicit dependency? Does the nuget package have to be defined in some project in the hierarchy of projects that depend on the project using the package? Is it just some solution-level configuration I’ve missed? And why are they different?

I’ve searched and haven’t been able to locate anything that explains how but maybe I missed it. Thanks and apologies if this is a stupid question


Viewing all articles
Browse latest Browse all 3067

Trending Articles



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