I published a package(.net461) to a feed, this package imports several other feeds by NuGet manager.
But when I download the package, I found the nupkg zip file doesn't have dependency dlls in lib/net461 folder. I could only see the project dll itself and no dependency dlls. I am confused on how nuget take care of these dependencies, and how things work if the dependency dll is not there? Appreciate any helps!
CodePudding user response:
Nuget does not include the dependencies, it references them, by adding an information about what other packages need to be downloaded.
The easiest way to see them is to use the NugetPackageManager (from here). If you open the nupkg file with this tool, you can see the dependencies of your package at the bottom of the package metadata.
If you use your nuget (let's call it "B") in another project ("C"), then the dependencies ("A") will automatically be copied to the project output folder of "C" during build, so that your library will work fine. That is C references B and B references A. When building C, all three outputs A, B and C will be copied together automatically so that C will run. That means that when writing C, one doesn't even need to know that library B uses A. However, if C also requires using types or methods from A, then a direct reference is required. But again, nothing needs to be copied manually, just add a reference to the nuget of A to project C.
