25'ten fazla konu seçemezsiniz Konular bir harf veya rakamla başlamalı, kısa çizgiler ('-') içerebilir ve en fazla 35 karakter uzunluğunda olabilir.
 
 
 
 
 
 

56 satır
1.4 KiB

  1. param($installPath, $toolsPath, $package, $project)
  2. $analyzersPaths = Join-Path (Join-Path (Split-Path -Path $toolsPath -Parent) "analyzers" ) * -Resolve
  3. foreach($analyzersPath in $analyzersPaths)
  4. {
  5. # Uninstall the language agnostic analyzers.
  6. if (Test-Path $analyzersPath)
  7. {
  8. foreach ($analyzerFilePath in Get-ChildItem $analyzersPath -Filter *.dll)
  9. {
  10. if($project.Object.AnalyzerReferences)
  11. {
  12. $project.Object.AnalyzerReferences.Remove($analyzerFilePath.FullName)
  13. }
  14. }
  15. }
  16. }
  17. # $project.Type gives the language name like (C# or VB.NET)
  18. $languageFolder = ""
  19. if($project.Type -eq "C#")
  20. {
  21. $languageFolder = "cs"
  22. }
  23. if($project.Type -eq "VB.NET")
  24. {
  25. $languageFolder = "vb"
  26. }
  27. if($languageFolder -eq "")
  28. {
  29. return
  30. }
  31. foreach($analyzersPath in $analyzersPaths)
  32. {
  33. # Uninstall language specific analyzers.
  34. $languageAnalyzersPath = join-path $analyzersPath $languageFolder
  35. if (Test-Path $languageAnalyzersPath)
  36. {
  37. foreach ($analyzerFilePath in Get-ChildItem $languageAnalyzersPath -Filter *.dll)
  38. {
  39. if($project.Object.AnalyzerReferences)
  40. {
  41. try
  42. {
  43. $project.Object.AnalyzerReferences.Remove($analyzerFilePath.FullName)
  44. }
  45. catch
  46. {
  47. }
  48. }
  49. }
  50. }
  51. }