Skip to content

[Epic]: Central Package Management improvements for 17.4 #11952

Closed

Description

@jeffkl

Issues

Features

  • No one location to specify metadata like NoWarn
    Since Microsoft.Build.CentralPackageVersions uses the Update guesture, it lets users specify a version for a package as well as other metadata like NoWarn. However, in NuGet's CPM we only have a <PackageVersion /> item and it wouldn't make sense to specify NoWarn on a package version. Users will need to add a <PackageReference Update="" NoWarn="1234" /> to their Directory.Packages.props.

Pull Requests

Documentation

Activity

  1. self-assigned this
    on Jul 7, 2022
  2. jeffkl commented on Aug 30, 2022

    @jeffkl
    ContributorAuthor
  3. AArnott commented on Aug 30, 2022

    @AArnott
    Contributor

    Please seriously consider #9464 as part of this. It's a very important scenario for us.

  4. jeffkl commented on Sep 1, 2022

    @jeffkl
    ContributorAuthor

    Please seriously consider #9464 as part of this. It's a very important scenario for us.

    @AArnott I thought when we discussed #9464 that we came to the conclusion that some tooling was needed there? NuGet restores each project in a silo due to the nature of how .NET builds work. NuGet doesn't know that another project is transitively referencing a different version of a dependency unless those two projects depend on each other. To truly achieve what #9464 asks for, we'd need tooling like Dependabot to analyze a whole repository to unify the dependency tree. Central package management allows us to define package versions in one location but won't be directly addressing updates across entire repositories transitively when projects don't reference each other. That said, I still think it would be awesome for a tool like that to exist.

  5. AArnott commented on Sep 1, 2022

    @AArnott
    Contributor

    Oh yes, I remember now. Sad. Maybe we should close #9464 with the explanation then. I can't because someone on the NuGet team created that issue on my behalf.

  6. jeffkl commented on Sep 1, 2022

    @jeffkl
    ContributorAuthor

    I'll update the issue and leave it open for now. I still like the idea of it all, I just don't think central package management can solve it at this time.

  7. jeffkl commented on Sep 15, 2022

    @jeffkl
    ContributorAuthor

    Closing now that all work is complete for this epic. This item tracks additional work related to tooling: #9015

  8. robmen commented on Sep 22, 2022

    @robmen

    This Epic is closed, but issue #11822 is still open. Is the Cut line in the wrong place?

  9. jeffkl commented on Sep 26, 2022

    @jeffkl
    ContributorAuthor

    This Epic is closed, but issue #11822 is still open. Is the Cut line in the wrong place?

    I'm fairly confident that the next release will address #11822 but I'm waiting for the person who opened the issue to get a preview version and see if they agree. I've left it open until then but will probably close it soon.

  10. DevBaburaj commented on Nov 9, 2022

    @DevBaburaj

    @jeffkl, is "No one location to specify metadata like NoWarn" part of this release? Asking as I don't see it "ticked" above nor is it mentioned in the 6.4 release announcement.

  11. jeffkl commented on Nov 9, 2022

    @jeffkl
    ContributorAuthor

    @jeffkl, is "No one location to specify metadata like NoWarn" part of this release? Asking as I don't see it "ticked" above nor is it mentioned in the 6.4 release announcement.

    @DevBaburaj unfortunately I couldn't come up with a good design for PackageReference NoWarn in one place. Directory.Packages.props is imported at the top of a project so it can't do <PackageReference Update="" NoWarn="NU1000" /> and there's nothing else in central package management that made sense to extend at the moment.

    Flowing NoWarn metadata from a PackageVersion seemed clunky since it really should just specify a version. We could potentially add yet another item like <PackageNoWarn Include="SomePackage" NoWarn="NU1000" /> but that's not great in my opinion.

    The best solution if you want a particular package reference to always have a NoWarn for every project in your repository is to add this to your Directory.Build.targets:

    <Project>
      <ItemGroup>
        <PackageReference Update="SomePackage" NoWarn="%(NoWarn);NU1000" />
      </ItemGroup>
    </Project>

    Otherwise you'll just need to specify the NoWarn metadata on the <PackageReference /> in each project. Depending on the size of your tree, this might not be too bad.

  12. zarenner commented on Nov 11, 2022

    @zarenner

    Looks like .NET SDK 6.0.403 was released. I was hoping it'd include these improvements but appears not.
    https://dotnet.microsoft.com/en-us/download/dotnet/6.0 originally said Included in Visual Studio ... 17.4.0 but now has been reverted back to say 17.3.7 (dotnet/core#7955) so I'm hoping this'll be in the next SDK release?

  13. jeffkl commented on Nov 11, 2022

    @jeffkl
    ContributorAuthor

    @zarenner Visual Studio 17.4 released with .NET SDK 7.0.100 and NuGet along with other components of the .NET developer ecosystem stopped inserting into .NET SDK 6.x. Are you able to use .NET SDK 7?

  14. zarenner commented on Nov 15, 2022

    @zarenner

    @jeffkl thanks, wasn't aware. We were considering skipping .NET 7 (incl. sdk) at least for now as its a STS release, but this might change the equation since Microsoft.Build.CentralPackageVersions doesn't support transitive pinning and we really want it 😄. Have to reevaluate. I take it there's no easy way to get transitive pinning on 6?

  15. jeffkl commented on Nov 15, 2022

    @jeffkl
    ContributorAuthor

    I take it there's no easy way to get transitive pinning on 6?

    Transitive pinning shipped in Visual Studio 2022 17.2 (NuGet/NuGet.Client#4025) and .NET SDK 6.0.3xx. But the features you'll miss in .NET SDK 6 are:

    • GlobalPackageReference
    • Metadata like PrivateAssets do not flow to transitively pinned references
    • Preview message removal

    .NET 7.0 is definitely worth checking out though...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Area:RestoreCPMCentral package managementEpicType:TrackingThis issue is tracking the completion of other related issues.

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions