forked from sky-uk/WebApiThrottle
-
Notifications
You must be signed in to change notification settings - Fork 0
/
DependencyAnalyzer.ps1
18 lines (14 loc) · 795 Bytes
/
DependencyAnalyzer.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
$solution = (Get-ChildItem . -Filter "*.sln" -Recurse | Select-Object -First 1)
Get-Content ($solution.FullName) |
Select-String 'Project\(' |
ForEach-Object {
$projectParts = $_ -Split '[,=]' | ForEach-Object { $_.Trim('[ "{}]') }
$pluginPath = Join-Path -Path ".\" -ChildPath "packages/DotnetDependencyAnalyzer.1.2.3/tools"
$projectPath = Join-Path -Path ".\" -ChildPath $projectParts[1]
$project = (Get-ChildItem -Path $projectPath -Filter "*.csproj" -Recurse -ErrorAction SilentlyContinue -Force | Select-Object -First 1)
if ($project) {
$plugin = (Get-ChildItem -Path $pluginPath -Filter "DotnetDependencyAnalyzer.exe" -Recurse -ErrorAction SilentlyContinue -Force | Select-Object -First 1)
& $plugin.Fullname $projectPath
Write-Output ''
}
}