Central Package Management in .NET - What is it?

แชร์
ฝัง
  • เผยแพร่เมื่อ 13 ม.ค. 2025

ความคิดเห็น • 35

  • @davidmataviejo3313
    @davidmataviejo3313 18 วันที่ผ่านมา +22

    For those wondering why this is useful, it's likely they haven't worked on large projects. In such projects, it's common for different components to use varying versions of the same library, leading to compatibility issues and errors.

    • @Anno_Nymous
      @Anno_Nymous 18 วันที่ผ่านมา +4

      nuget package manager, at solution level gives warnings when you have mismatches which is enough for me tbh, nevertheless this can be helpfull in keeping things clean. downside is when adding a new package you will need to manually add it to the buildprops file.

    • @timmkrause6684
      @timmkrause6684 18 วันที่ผ่านมา +1

      @@Anno_NymousI think VS as well as Rider do detect/support central package management and they will add it accordingly.

    • @T___Brown
      @T___Brown 18 วันที่ผ่านมา +1

      Damn. A feature just short of what is actually needed.

    • @MilanJovanovicTech
      @MilanJovanovicTech  17 วันที่ผ่านมา +1

      @Anno_Nymous Actually - when I recently tried this you can just install the NuGet and it will be added to the packages props file correctly. Maybe it was a recent VS update, can't tell

    • @T___Brown
      @T___Brown 17 วันที่ผ่านมา

      @@MilanJovanovicTech i think i prefer a private nuget with allowed versions

  • @ciekawki6574
    @ciekawki6574 18 วันที่ผ่านมา +2

    I don't get it. What if I need to have multiple versions of the same package across different projects? Wouldn't that complicate things even further?

    • @Anno_Nymous
      @Anno_Nymous 18 วันที่ผ่านมา +5

      yes it will, however so will using different version of the same package, especially if the projects have relations with each-other. you should fix version mismatches it can give headaches later on.

    • @orterves
      @orterves 18 วันที่ผ่านมา

      It's generally better practice to keep package versions the same across projects. Paket is a good alternative, it provides dependency groups when that extra finesse is required.

    • @MilanJovanovicTech
      @MilanJovanovicTech  17 วันที่ผ่านมา +1

      No - you can still override the package version where needed

    • @gabrielnzete8913
      @gabrielnzete8913 17 วันที่ผ่านมา

      that is why you need it

  • @Paul-uo9sv
    @Paul-uo9sv 18 วันที่ผ่านมา

    Is this for solution level for all projects within the solution?

  • @Piyush-mg4zq
    @Piyush-mg4zq 18 วันที่ผ่านมา +1

    How will it benefit?

    • @pderuiter77
      @pderuiter77 18 วันที่ผ่านมา +3

      If you have 5 projects, you can make sure all those projects have the same version of a package.

    • @MilanJovanovicTech
      @MilanJovanovicTech  18 วันที่ผ่านมา +1

      Managing package versions in one place - works really nice for large projects

    • @edgarskurpnieks476
      @edgarskurpnieks476 18 วันที่ผ่านมา

      Does that props file have to be located in the same solution? If i have multiple repos with multiple solutions, what then?

    • @notXarv
      @notXarv 18 วันที่ผ่านมา

      No more consolidating packages

    • @MilanJovanovicTech
      @MilanJovanovicTech  18 วันที่ผ่านมา

      @@edgarskurpnieks476 Can be solution level, or folder level. I think this is meant for a single solution, but you could share it if you import the same props file in all solutions.

  • @chenz2584
    @chenz2584 18 วันที่ผ่านมา

    Is it ready for using in production?

  • @orterves
    @orterves 18 วันที่ผ่านมา

    It's a shame Paket isn't more popular, but this is OK as an alternative I guess

    • @MilanJovanovicTech
      @MilanJovanovicTech  17 วันที่ผ่านมา

      You can't really compete with NuGet in this space

    • @orterves
      @orterves 17 วันที่ผ่านมา

      @MilanJovanovicTech have you tried Paket?

  • @thomasvlima
    @thomasvlima 18 วันที่ผ่านมา

    Is there any way to do that from the Visual Studio GUI already?

    • @sweeperq
      @sweeperq 18 วันที่ผ่านมา

      Kind of. You can manage nuget packages at the solution level. It will tell you which version is installed in each project and allow you to install/update accordingly.

    • @thomasvlima
      @thomasvlima 18 วันที่ผ่านมา

      @sweeperq yes, but its another feature. I was asking about the feature presented in the vídeo.

    • @Anno_Nymous
      @Anno_Nymous 18 วันที่ผ่านมา

      Yes, go to tools > nuget package manager > manage package for solution. here you have your central package managment. you can see all your packages, see what is the latest version, see if there are updates, see if packages are deprecated, etc etc. It's the industry standard, and yes also for large projects. it warns you for if you have different versions for the same package across projects, the managepackeversioncentrally just uses 1 file with the version and packages for all files (so you wont get version mismatches)

    • @Anno_Nymous
      @Anno_Nymous 18 วันที่ผ่านมา

      @@thomasvlima no, you have to add the new file, name it add the projects. end edit all project files.after that you can use nuget package managment as normal, however adding a new package need manual editing again. so it does add complexity.

    • @MilanJovanovicTech
      @MilanJovanovicTech  17 วันที่ผ่านมา

      Wrote a blog post here: www.milanjovanovic.tech/blog/central-package-management-in-net-simplify-nuget-dependencies
      There's a tool to help you migrate. Then you can continue working from the GUI

  • @decisivepro1961
    @decisivepro1961 18 วันที่ผ่านมา

    In the nuget package manager, you can already install/update packages for all projects. I don't see any advantage here

    • @Code_Bits
      @Code_Bits 18 วันที่ผ่านมา +2

      Thats not the same

    • @Anno_Nymous
      @Anno_Nymous 18 วันที่ผ่านมา +1

      @@Code_Bits sometimes you need the same package in multiple project of the solution, this will prevent have for instance version 2.1.1 of a package in project A, while having 2.1.3 in project B for example.

    • @MilanJovanovicTech
      @MilanJovanovicTech  17 วันที่ผ่านมา

      Read this: www.milanjovanovic.tech/blog/central-package-management-in-net-simplify-nuget-dependencies