问题
Is it true that for every dependency that a package has on some other library, that those libraries need to be resolved and installed as well?
For example, I created a package which uses NLog
, Postsharp
and WindowsAzure.Storage
:
Do clients of my package now have to install these packages as well? Why is it not possible to include these dependency DLLs within the package?
回答1:
When a consumer installs your nuget package, nuget will automatically resolve and install the dependent packages as well.
It is possible to include the dlls within the package but it is not recommended. Because one way or another they will have to have references to the dlls they need to use your package( in this case NLog
, PostSharp
and WindowsAzure.Storage
). Its better that the consumer have controll over what libraries are installed.
Another benefit of having dependencies via nuget is that the consumer may decide to install a newer version of WindowsAzure.Storage library which he can do easily when you don't have the dll injected into the package. Otherwise you can get into some messy assemblies runtime errors.
You control what your package contains via nuspec file used to build the nuget package.
来源:https://stackoverflow.com/questions/28229892/nuget-package-dependencies