简体   繁体   中英

Difference between Nuget & SDK dependencies in .Net Core project

I was looking into a .net core application recently & I found something I probably missed earlier. There are three types of dependencies :

  • Analyzers
  • Nuget
  • SDK

Analyzers are fair enough, but I am not sure about difference between Nuget & SDK dependency since they are also overlapping for same package in both like for Micosoft.AspNetCore.App(2.1.1) is available in both with all it's related dependencies in both SDK & nuget.

在此处输入图片说明

This is by default .net core Asp.net web API with docker without any change in pacakages or dependencies.

Why packages are required in two places as dependencies?

I was wondering the same thing and while I don't have a direct answer to your question, here is what I found.

Here is my summary:

  • NuGet feels (to me)
    • more lightweight
      • no built-in documentation
    • portable
  • SDK feels
    • more robust
      • Documentation, better Intellisense support, examples, tutorials etc.
    • tightly coupled
      • connected to specific platform or language
      • the Android SDK won't help develpment in iOS and vice versa

Research

NuGet is an open-source package-management system that simplifies the process of incorporating libraries into a project.

SDK can (and probably should have) Documentation, Tutorials, Debugging assistance in addition to API's and/or Code libraries. ie Platform and/or language specific. SeeWhat is an SDK

Over at this NuGet versus SDK as a project reference page on Visual Studio Docs, they have a grid comparing and contrasting the two. It got more technical than I could follow, but it gave me a general feeling of what is the right direction for my solution.

The SDK part is called Shared Framework and was introduced in Dotnet Core 2.1 . You can remove duplicate nugets and use same functionality from SDK, or you can override SDK package version by referencing nuget package directly. For more info and history check this great post from Andrew Lock: Exploring the Microsoft.AspNetCore.App shared framework in ASP.NET Core 2.1 (preview 1)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM