You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
49 lines
1.3 KiB
PowerShell
49 lines
1.3 KiB
PowerShell
param($installPath, $toolsPath, $package, $project)
|
|
|
|
$analyzersPaths = Join-Path (Join-Path (Split-Path -Path $toolsPath -Parent) "analyzers" ) * -Resolve
|
|
|
|
foreach($analyzersPath in $analyzersPaths)
|
|
{
|
|
# Install the language agnostic analyzers.
|
|
if (Test-Path $analyzersPath)
|
|
{
|
|
foreach ($analyzerFilePath in Get-ChildItem $analyzersPath -Filter *.dll)
|
|
{
|
|
if($project.Object.AnalyzerReferences)
|
|
{
|
|
$project.Object.AnalyzerReferences.Add($analyzerFilePath.FullName)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
# $project.Type gives the language name like (C# or VB.NET)
|
|
$languageFolder = ""
|
|
if($project.Type -eq "C#")
|
|
{
|
|
$languageFolder = "cs"
|
|
}
|
|
if($project.Type -eq "VB.NET")
|
|
{
|
|
$languageFolder = "vb"
|
|
}
|
|
if($languageFolder -eq "")
|
|
{
|
|
return
|
|
}
|
|
|
|
foreach($analyzersPath in $analyzersPaths)
|
|
{
|
|
# Install language specific analyzers.
|
|
$languageAnalyzersPath = join-path $analyzersPath $languageFolder
|
|
if (Test-Path $languageAnalyzersPath)
|
|
{
|
|
foreach ($analyzerFilePath in Get-ChildItem $languageAnalyzersPath -Filter *.dll)
|
|
{
|
|
if($project.Object.AnalyzerReferences)
|
|
{
|
|
$project.Object.AnalyzerReferences.Add($analyzerFilePath.FullName)
|
|
}
|
|
}
|
|
}
|
|
} |