Search code examples
c#nugetnuget-package

Can I download only necessary NuGet packages and skip transitive dependencies?


When I want to do my own NuGet package with custom authentication scheme, I need to download Microsoft.AspNetCore.Authentication that contains the AuthenticationScheme class. I need only this one class but together with this package 36 transitive packages are downloaded. How can I reject these extra packages? Is it possible?


Solution

  • When you take onboard a new dependency you implicitly takes on its transitive dependencies. If you start messing with it then code you want to depend on will not work. It is just the price you pay for the dependency.