Skip to content

Instantly share code, notes, and snippets.

@mvalipour
Created October 3, 2016 10:57
Show Gist options
  • Select an option

  • Save mvalipour/fb0af8c7cba7c4b88f9997f602813ee1 to your computer and use it in GitHub Desktop.

Select an option

Save mvalipour/fb0af8c7cba7c4b88f9997f602813ee1 to your computer and use it in GitHub Desktop.
Check for nuget consolidation across your solution
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