Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
14 of 21 tasks
jeffkl opened this issue Jul 7, 2022 · 14 comments
Closed
14 of 21 tasks

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

jeffkl opened this issue Jul 7, 2022 · 14 comments
Assignees
Labels
Area:RestoreCPM Central package management Epic Type:Tracking This issue is tracking the completion of other related issues.

Comments

@jeffkl
Copy link
Contributor

jeffkl commented Jul 7, 2022

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

@jeffkl
Copy link
Contributor Author

jeffkl commented Aug 30, 2022

@AArnott
Copy link
Contributor

AArnott commented Aug 30, 2022

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

@jeffkl
Copy link
Contributor Author

jeffkl commented Sep 1, 2022

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.

@AArnott
Copy link
Contributor

AArnott commented Sep 1, 2022

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.

@jeffkl
Copy link
Contributor Author

jeffkl commented Sep 1, 2022

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.

@jeffkl
Copy link
Contributor Author

jeffkl commented Sep 15, 2022

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

@jeffkl jeffkl closed this as completed Sep 15, 2022
@robmen
Copy link

robmen commented Sep 22, 2022

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

@jeffkl
Copy link
Contributor Author

jeffkl commented Sep 26, 2022

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.

@DevBaburaj
Copy link

@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.

@jeffkl
Copy link
Contributor Author

jeffkl commented Nov 9, 2022

@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.

@zarenner
Copy link

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?

@jeffkl
Copy link
Contributor Author

jeffkl commented Nov 11, 2022

@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?

@zarenner
Copy link

@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?

@jeffkl
Copy link
Contributor Author

jeffkl commented Nov 15, 2022

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
Labels
Area:RestoreCPM Central package management Epic Type:Tracking This issue is tracking the completion of other related issues.
Projects
None yet
Development

No branches or pull requests

6 participants