Dotnetarium.Analyzers 2.2.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package Dotnetarium.Analyzers --version 2.2.0
                    
NuGet\Install-Package Dotnetarium.Analyzers -Version 2.2.0
                    
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="Dotnetarium.Analyzers" Version="2.2.0">
  <PrivateAssets>all</PrivateAssets>
  <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Dotnetarium.Analyzers" Version="2.2.0" />
                    
Directory.Packages.props
<PackageReference Include="Dotnetarium.Analyzers">
  <PrivateAssets>all</PrivateAssets>
  <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Dotnetarium.Analyzers --version 2.2.0
                    
#r "nuget: Dotnetarium.Analyzers, 2.2.0"
                    
#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.
#:package Dotnetarium.Analyzers@2.2.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Dotnetarium.Analyzers&version=2.2.0
                    
Install as a Cake Addin
#tool nuget:?package=Dotnetarium.Analyzers&version=2.2.0
                    
Install as a Cake Tool

Dotnetarium

Dotnetarium checks modern C# projects for security problems. It follows untrusted data through code and reports other unsafe patterns. Findings use DNA rule IDs and include CWE groups.

Use the NuGet analyzer to see findings during a build, or the global tool to scan a project or solution and produce SARIF for CI. Both use the same rules.

It checks injection paths through SQL, commands, HTML, file paths, redirects, LDAP, XPath, outbound requests, and dynamic code. It also checks risky Json.NET polymorphism settings, hardcoded secrets, cookie and gRPC settings, and modern .NET cryptography usage, including a separate post-quantum private-key rule. Request inputs include MVC, Minimal APIs, Razor Pages, Blazor, ASP.NET Core gRPC services and server interceptors, SignalR hubs, accepted WebSocket buffers, HTTP body pipelines, and Azure Functions isolated-worker HTTP/Service Bus triggers. See the rule notes for coverage and limitations, including Razor and Blazor, gRPC, and SignalR.

Install

Add the analyzer to each C# project you want checked:

dotnet add MyApp.csproj package Dotnetarium.Analyzers

Install the scanner once per machine:

dotnet tool install --global dotnetarium

The global tool needs the .NET 10 runtime and an installed SDK that can load the project. It scans C# projects targeting .NET 8 or .NET 10. For IDE diagnostics, the analyzer needs a Roslyn 5.0 host such as Visual Studio 2026.

Scan a project or solution

dotnetarium MyApp.sln
dotnetarium MyApp.sln --sarif results.sarif --fail

The tool accepts .csproj, .sln, and .slnx files. --sarif writes SARIF 2.1.0 with relative source paths and available data-flow paths. --fail returns exit code 1 when there are findings, which is useful in CI. Without it, findings are printed but do not fail the command. An incomplete scan or invalid input returns exit code 2.

The tool selects an installed SDK using the scanned project or solution directory, including its global.json if present. Run dotnetarium --help for the complete CLI.

Configure rules

Built-in models cover common .NET and provider APIs. To add a source, sink, sanitizer, or transfer, place dotnetarium.json beside a project. The NuGet analyzer picks it up during builds, and the global tool finds it when scanning that project. For a solution scan, a file beside the solution applies to projects without their own config. Use --config path/to/rules.json to override automatic discovery for a scan.

Use .editorconfig to change a diagnostic's severity:

[*.cs]
dotnet_diagnostic.DNA0010.severity = error

See the configuration guide for the JSON format.

Run from source

With a .NET 10 SDK installed, clone this repository and run from its root:

dotnet run --project Dotnetarium.Tool/Dotnetarium.Tool.csproj -- MyApp.sln --sarif results.sarif --fail

Moving from 1.x

New features go to 2.x. Version 1.3.0 remains available for VB.NET and .NET Framework 4.8 projects on release/1.x. Version 2 supports C# projects targeting .NET 8 or 10.

To move a supported C# project to 2.x, replace the Dotnetarium.Analyzers.SCS package with Dotnetarium.Analyzers and the dotnetarium-scs command with dotnetarium. Rule IDs now use the DNA prefix; update any .editorconfig settings and SARIF filters. Use dotnetarium.json in place of YAML rule extensions.

About this repository

The repository contains the analyzer, global tool, tests, and selected Roslyn flow utilities. See the architecture notes and release instructions.

Dotnetarium 2.x is licensed under Apache License 2.0. Bundled Roslyn sources retain their original licenses; see third-party notices.

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
2.10.0 57 11/27/2026
2.9.0 2,550 11/10/2026
2.8.1 5,393 10/19/2026
2.8.0 1,290 10/17/2026
2.7.3 177 10/16/2026
2.7.2 134 10/16/2026
2.7.1 431 10/15/2026
2.7.0 190 10/15/2026
2.6.0 346 10/14/2026
2.5.0 1,195 10/8/2026
2.4.1 1,469 10/6/2026
2.4.0 109 10/5/2026
2.3.0 120 10/3/2026
2.2.0 115 10/3/2026
2.1.0 122 10/2/2026
2.0.0 115 10/1/2026