MSBuildSdks icon indicating copy to clipboard operation
MSBuildSdks copied to clipboard

Automate removal of Packages.props entries not used elsewhere

Open stan-sz opened this issue 3 years ago • 3 comments

The number of entries in Packages.props keeps growing. Can we have a way (ideally a build breaking message) that some entries are extraneous and not used elsewhere in the repo?

stan-sz avatar Jul 13 '22 08:07 stan-sz

Each MSBuild project builds in isolation so it would not be possible as far as I am aware to introduce a build break when an entry isn't used somewhere. I think the best solution would be to run something as part of a CI build that would look at the result of restore and see if any packages in Packages.props weren't used.

jeffkl avatar Jul 14 '22 18:07 jeffkl

Thanks. Your solution would have been easier with #337 implemented. I'd like to keep this issue open for sharing ideas how to solve it.

stan-sz avatar Jul 15 '22 08:07 stan-sz

That would entirely depend on the consumer using both centralpackageversioning AND traversal - Logic to retrieve packages by querying the tree from the root down would need to be inside the SLN targets before anything happens in the CPV logic unless the ProjectReference Protocol has been expanded to include the assets.json logic recently?

MeikTranel avatar Jul 15 '22 14:07 MeikTranel