microsoft / MSBuildSdks

MSBuild project SDKs
MIT License
453 stars 81 forks source link

Automate removal of Packages.props entries not used elsewhere #374

Open stan-sz opened 2 years ago

stan-sz commented 2 years ago

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?

jeffkl commented 2 years ago

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.

stan-sz commented 2 years ago

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.

MeikTranel commented 2 years ago

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?