
.NET project file analyzers
Contains 140+ Roslyn (static code) diagnostic analyzers that report issues on .NET project files.
Documentation
The full documentation can be found here.
Installation
| Packages | NuGet |
|————————————————————————————————–|————————————————————————————————————————————————————————————————————————————————————————–|
|DotNetProjectFile.Analyzers | |
|DotNetProjectFile.Analyzers.Sdk|
|
Analyzers
To use the analyzers, you must include the analyzer NuGet package in your project file:
<Project Sdk="Microsoft.NET.Sdk">
<ItemGroup>
<PackageReference Include="DotNetProjectFile.Analyzers" Version="*" PrivateAssets="all" ExcudeAssets="runtime" />
</ItemGroup>
</Project>
or via PowerShell:
Install-Package DotNetProjectFile.Analyzers
Configuration
The analyzer rules can be configured using the .globalconfig file or by using <GlobalAnalyzerConfigFiles>.
Instructions can be found here.
An example configuration with the default severities of the main branch of the analyzer can be found here.
SDK
To use the SDK, follow the instructions here.
Community
Reference an analyzer from a project
For debugging/development purposes, it can be useful to reference the analyzer project directly. As mentioned here, this can be achieved by adding the following to your project file:
<Project Sdk="Microsoft.NET.Sdk">
<ItemGroup Label="Analyzer">
<ProjectReference
Include="../../src/DotNetProjectFile.Analyzers/DotNetProjectFile.Analyzers.csproj"
PrivateAssets="all"
ReferenceOutputAssembly="false"
OutputItemType="Analyzer"
SetTargetFramework="TargetFramework=netstandard2.0" />
</ItemGroup>
</Project>