IllegalClassReferenceAnalyzer 1.0.0.3

dotnet add package IllegalClassReferenceAnalyzer --version 1.0.0.3                
NuGet\Install-Package IllegalClassReferenceAnalyzer -Version 1.0.0.3                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="IllegalClassReferenceAnalyzer" Version="1.0.0.3" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add IllegalClassReferenceAnalyzer --version 1.0.0.3                
#r "nuget: IllegalClassReferenceAnalyzer, 1.0.0.3"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install IllegalClassReferenceAnalyzer as a Cake Addin
#addin nuget:?package=IllegalClassReferenceAnalyzer&version=1.0.0.3

// Install IllegalClassReferenceAnalyzer as a Cake Tool
#tool nuget:?package=IllegalClassReferenceAnalyzer&version=1.0.0.3                

IllegalClassReferenceAnalyzer

Diagnostics Analyzer that prohibits use of referenced Types in dependency injection.

This analyzer will mark as error all references to a specified list of Types. The specified list can be provided per project using this analyzer as an AdditionalFile. The structure of the file must be as such:

<?xml version="1.0" encoding="utf-8" ?>
<AnalyzerSettings>
	<ForbiddenType>System.Net.Http.IHttpClientFactory</ForbiddenType>
</AnalyzerSettings>

This AdditionalFile will prohibit all references to System.Net.Http.IHttpClientFactory. Additional ForbiddenType elements can be inserted as needed.

AdditionalFile entries should be added to the project's csproj file as such:

<ItemGroup>
	<AdditionalFiles Include="Settings\IllegalTypes.xml" />
</ItemGroup>

The analyzer will iterate all AdditionalFiles and parse the ones that have the compatible structure above.

In some cases, for multi project solutions, one or more projects may be referencing the same additional file. In cases where some of these projects need to exclude one or more type from the common AdditionalFile, they can have secondary exclusive AdditionalFiles only referenced by these projects, using the AllowedType node:

<?xml version="1.0" encoding="utf-8" ?>
<AnalyzerSettings>
	<AllowedType>System.Net.Http.IHttpClientFactory</AllowedType>
</AnalyzerSettings>
There are no supported framework assets in this package.

Learn more about Target Frameworks and .NET Standard.

This package has no dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.0.0.3 1,111 12/2/2023
1.0.0.2 113 11/29/2023
1.0.0.1 143 11/29/2023
1.0.0 100 11/27/2023

Added support for AllowedType xml nodes.