Created
October 3, 2016 10:57
-
-
Save mvalipour/fb0af8c7cba7c4b88f9997f602813ee1 to your computer and use it in GitHub Desktop.
Check for nuget consolidation across your solution
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Get-ChildItem -Recurse -Depth 5 -Path "." | | |
| ? { $_.Name -eq "packages.config" } | | |
| % { ([xml](Get-Content -Path $_.FullName)).packages.package | select id, version } | | |
| Group-Object -Property id | | |
| select Name, @{ Name="Versions"; Expression= { $_.Group | select -ExpandProperty version -Unique }} | | |
| ? { $_.Versions.Count -gt 1 } | | |
| Sort-Object -Property Name | | |
| % { Write-Error "Package '$($_.Name)' has multiple versions used across the solution! $($_.Versions)" } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment