Last active
August 29, 2015 14:02
-
-
Save lkaczanowski/b3835922ebfa314658f7 to your computer and use it in GitHub Desktop.
Lists installed packages per project in solution
This file contains 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
Register-TabExpansion 'Get-SolutionPackages' @{ | |
'PackageName' = { Get-Package | Sort-Object -Property Id -Unique | foreach { $_.Id } } | |
} | |
function Get-SolutionPackages($PackageName) { | |
$nl = [Environment]::NewLine | |
$packageSummaryList = @() | |
Get-Project -All | ForEach-Object { | |
$projectName = $_.ProjectName | |
Get-Package -ProjectName $projectName | ForEach-Object { | |
$packageSummary = New-Object System.Object | |
$packageSummary | Add-Member -type NoteProperty -name Id -value $_.Id | |
$packageSummary | Add-Member -type NoteProperty -name Version -value $_.Version | |
$packageSummary | Add-Member -type NoteProperty -name Project -value $projectName | |
$packageSummaryList += $packageSummary | |
} | |
} | |
if(!$packageName) { | |
$packageSummaryList | Sort-Object -Property Id, Version | |
} | |
else { | |
$packageSummaryList | Where-Object { $_.Id -eq $PackageName } | Sort-Object -Property Id, Version | |
} | |
} | |
function Get-DesynchronizedPackages { | |
$nl = [Environment]::NewLine | |
$packageSummaryList = @() | |
Get-Project -All | ForEach-Object { | |
$projectName = $_.ProjectName | |
Get-Package -ProjectName $projectName | ForEach-Object { | |
$packageSummary = New-Object System.Object | |
$packageSummary | Add-Member -type NoteProperty -name Id -value $_.Id | |
$packageSummary | Add-Member -type NoteProperty -name Version -value $_.Version | |
$packageSummary | Add-Member -type NoteProperty -name Project -value $projectName | |
$packageSummaryList += $packageSummary | |
} | |
} | |
$packageSummaryList | Sort-Object -Property Id, Version -Unique | Group-Object Id | Where-Object { $_.Count -gt 1 } | Select-Object -ExpandProperty Group | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment