forked from chriseyre2000/Powershell
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Compare-PackageToProject.ps1
37 lines (25 loc) · 987 Bytes
/
Compare-PackageToProject.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
function Compare-PackageToProject()
{
<#
.Synopsis
Compare the contents of the packages.config with the help paths in the csproj file to see if there are differences.
Please note that some differences are to be expected.
.EXAMPLE
dir -Recurse *.Csproj | % {Compare-PackageToProject -Verbose $_}
#>
[CmdletBinding()]
param(
[Parameter(Mandatory=$True,Position=1,ValueFromPipelineByPropertyName=$True)]
[string]$FullName
)
Write-Verbose $FullName
$directory = (Get-ChildItem -Path $FullName).Directory
[xml]$package = get-content $directory\packages.config
$pkgdata = $package.packages.package | select @{Name="Path";Expression = {$_.Id + "." + $_.Version}}
$filename = $FullName
write-host $filename
[xml]$project = get-content $filename
$projdata = $project.Project.ItemGroup.Reference.HintPath | select -Unique @{Name="Project";Expression={("$_" -split "\\")[2] }}
Compare-Object $pkgdata $projdata
}