Skip to content

Commit dd50e7b

Browse files
committed
Fix Added in project
1 parent 442dd53 commit dd50e7b

5 files changed

Lines changed: 155 additions & 11 deletions

File tree

System.IO.Abstractions.Analyzers.Tests/System.IO.Abstractions.Analyzers.Tests.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@
77
</PropertyGroup>
88

99
<ItemGroup>
10-
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.9.0" />
10+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.0.1" />
1111
<PackageReference Include="xunit" Version="2.4.1" />
12-
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.0" />
12+
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.1" />
1313
</ItemGroup>
1414

1515
<ItemGroup>

System.IO.Abstractions.Analyzers/FileSystemContext.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,6 @@ public FileSystemContext(Compilation compilation)
1414
_lazyIFileSystemType = new Lazy<INamedTypeSymbol>(() => compilation.GetTypeByMetadataName(typeof(IFileSystem).FullName));
1515
}
1616

17-
public bool HasReference => FileSystemType != null;
17+
public bool HasReference => true;
1818
}
1919
}
Lines changed: 29 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,39 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFramework>netstandard2.0</TargetFramework>
4+
<TargetFramework>netstandard1.4</TargetFramework>
5+
<PackageTargetFallback>portable-net45+win8+wp8+wpa81</PackageTargetFallback>
6+
<IncludeBuildOutput>false</IncludeBuildOutput>
7+
<GeneratePackageOnBuild>True</GeneratePackageOnBuild>
8+
</PropertyGroup>
9+
<PropertyGroup>
10+
<PackageId>System.IO.Abstractions.Analyzers</PackageId>
11+
<PackageVersion>1.0.0</PackageVersion>
12+
<Authors>inyut</Authors>
13+
<PackageLicenseUrl>http://LICENSE_URL_HERE_OR_DELETE_THIS_LINE</PackageLicenseUrl>
14+
<PackageProjectUrl>https://h21res.visualstudio.com/H21Core/_git/H21Core.Analyzer/</PackageProjectUrl>
15+
<PackageIconUrl>http://ICON_URL_HERE_OR_DELETE_THIS_LINE</PackageIconUrl>
16+
<RepositoryUrl>https://h21res.visualstudio.com/H21Core/_git/H21Core.Analyzer</RepositoryUrl>
17+
<PackageRequireLicenseAcceptance>false</PackageRequireLicenseAcceptance>
18+
<Description>System.IO.Abstractions.Analyzers</Description>
19+
<PackageReleaseNotes>Summary of changes made in this release of the package.</PackageReleaseNotes>
20+
<Copyright>Copyright</Copyright>
21+
<PackageTags>System.IO.Abstractions.Analyzers, analyzers</PackageTags>
22+
<NoPackageAnalysis>true</NoPackageAnalysis>
23+
<LangVersion>latest</LangVersion>
524
</PropertyGroup>
6-
725
<ItemGroup>
826
<PackageReference Include="JetBrains.Annotations" Version="2018.3.0" PrivateAssets="all" />
9-
<PackageReference Include="Microsoft.CodeAnalysis.Analyzers" Version="2.6.3" />
27+
<PackageReference Include="Microsoft.CodeAnalysis.Analyzers" Version="2.6.3" PrivateAssets="all" />
1028
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="2.10.0" PrivateAssets="all" />
29+
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Workspaces" Version="2.10.0" PrivateAssets="all" />
1130
<PackageReference Update="NETStandard.Library" PrivateAssets="all" />
12-
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Workspaces" Version="2.10.0" />
13-
<PackageReference Include="Roslyn.Diagnostics.Analyzers" Version="2.6.3" />
14-
<PackageReference Include="System.ComponentModel.Composition" Version="4.5.0" />
15-
<PackageReference Include="System.IO.Abstractions" Version="3.0.10" />
31+
<PackageReference Include="Microsoft.CodeQuality.Analyzers" Version="2.6.3" PrivateAssets="all" />
32+
<PackageReference Include="Roslyn.Diagnostics.Analyzers" Version="2.6.3" PrivateAssets="all" />
33+
<PackageReference Include="System.IO.Abstractions" Version="3.1.1" />
34+
</ItemGroup>
35+
<ItemGroup>
36+
<None Update="tools\*.ps1" CopyToOutputDirectory="Always" Pack="true" PackagePath="" />
37+
<None Include="$(OutputPath)\$(AssemblyName).dll" Pack="true" PackagePath="analyzers/dotnet/cs" Visible="false" />
1638
</ItemGroup>
17-
1839
</Project>
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
param ($installPath, $toolsPath, $package, $project)
2+
3+
if ($project.Object.SupportsPackageDependencyResolution)
4+
{
5+
if ( $project.Object.SupportsPackageDependencyResolution())
6+
{
7+
# Do not install analyzers via install.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+
14+
foreach ($analyzersPath in $analyzersPaths)
15+
{
16+
if (Test-Path $analyzersPath)
17+
{
18+
# Install the language agnostic analyzers.
19+
foreach ($analyzerFilePath in Get-ChildItem -Path "$analyzersPath\*.dll" -Exclude * .resources.dll)
20+
{
21+
if ($project.Object.AnalyzerReferences)
22+
{
23+
$project.Object.AnalyzerReferences.Add($analyzerFilePath.FullName)
24+
}
25+
}
26+
}
27+
}
28+
29+
# $project.Type gives the language name like (C# or VB.NET)
30+
$languageFolder = ""
31+
if ($project.Type -eq "C#")
32+
{
33+
$languageFolder = "cs"
34+
}
35+
if ($project.Type -eq "VB.NET")
36+
{
37+
$languageFolder = "vb"
38+
}
39+
if ($languageFolder -eq "")
40+
{
41+
return
42+
}
43+
44+
foreach ($analyzersPath in $analyzersPaths)
45+
{
46+
# Install 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+
$project.Object.AnalyzerReferences.Add($analyzerFilePath.FullName)
55+
}
56+
}
57+
}
58+
}
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
param ($installPath, $toolsPath, $package, $project)
2+
3+
if ($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+
14+
foreach ($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 = ""
31+
if ($project.Type -eq "C#")
32+
{
33+
$languageFolder = "cs"
34+
}
35+
if ($project.Type -eq "VB.NET")
36+
{
37+
$languageFolder = "vb"
38+
}
39+
if ($languageFolder -eq "")
40+
{
41+
return
42+
}
43+
44+
foreach ($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+
}

0 commit comments

Comments
 (0)