Free cookie consent management tool by TermsFeed Policy Generator

source: trunk/tools/PersistenceCodeFix/PersistenceCodeFix/PersistenceCodeFix/tools/uninstall.ps1 @ 14933

Last change on this file since 14933 was 14933, checked in by gkronber, 7 years ago

#2520 added a code fix for generating StorableTypeAttributes

File size: 1.7 KB
Line 
1param($installPath, $toolsPath, $package, $project)
2
3if($project.Object.SupportsPackageDependencyResolution)
4{
5    if($project.Object.SupportsPackageDependencyResolution())
6    {
7        # Do not uninstall analyzers via uninstall.ps1, instead let the project system handle it.
8        return
9    }
10}
11
12$analyzersPaths = Join-Path (Join-Path (Split-Path -Path $toolsPath -Parent) "analyzers") * -Resolve
13
14foreach($analyzersPath in $analyzersPaths)
15{
16    # Uninstall the language agnostic analyzers.
17    if (Test-Path $analyzersPath)
18    {
19        foreach ($analyzerFilePath in Get-ChildItem -Path "$analyzersPath\*.dll" -Exclude *.resources.dll)
20        {
21            if($project.Object.AnalyzerReferences)
22            {
23                $project.Object.AnalyzerReferences.Remove($analyzerFilePath.FullName)
24            }
25        }
26    }
27}
28
29# $project.Type gives the language name like (C# or VB.NET)
30$languageFolder = ""
31if($project.Type -eq "C#")
32{
33    $languageFolder = "cs"
34}
35if($project.Type -eq "VB.NET")
36{
37    $languageFolder = "vb"
38}
39if($languageFolder -eq "")
40{
41    return
42}
43
44foreach($analyzersPath in $analyzersPaths)
45{
46    # Uninstall language specific analyzers.
47    $languageAnalyzersPath = join-path $analyzersPath $languageFolder
48    if (Test-Path $languageAnalyzersPath)
49    {
50        foreach ($analyzerFilePath in Get-ChildItem -Path "$languageAnalyzersPath\*.dll" -Exclude *.resources.dll)
51        {
52            if($project.Object.AnalyzerReferences)
53            {
54                try
55                {
56                    $project.Object.AnalyzerReferences.Remove($analyzerFilePath.FullName)
57                }
58                catch
59                {
60
61                }
62            }
63        }
64    }
65}
Note: See TracBrowser for help on using the repository browser.