NetAgents.Analyzers 26.11.20.3876

dotnet add package NetAgents.Analyzers --version 26.11.20.3876
                    
NuGet\Install-Package NetAgents.Analyzers -Version 26.11.20.3876
                    
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="NetAgents.Analyzers" Version="26.11.20.3876">
  <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="NetAgents.Analyzers" Version="26.11.20.3876" />
                    
Directory.Packages.props
<PackageReference Include="NetAgents.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 NetAgents.Analyzers --version 26.11.20.3876
                    
#r "nuget: NetAgents.Analyzers, 26.11.20.3876"
                    
#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 NetAgents.Analyzers@26.11.20.3876
                    
#: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=NetAgents.Analyzers&version=26.11.20.3876
                    
Install as a Cake Addin
#tool nuget:?package=NetAgents.Analyzers&version=26.11.20.3876
                    
Install as a Cake Tool

โœจ NetAgents

NuGet

Consistent C# standards, enforced on every build.

Keep formatting, naming, and code quality consistent across your .NET projects. NetAgents automatically formats your source files and applies available code fixes when you build.

๐Ÿ“ฆ Install

dotnet add package NetAgents.Analyzers

Requires the latest major .NET SDK: every release is built with the newest SDK, and its build task runs on that SDK's runtime. Your projects can target older .NET versions.

Set PrivateAssets="all" on the package reference to keep the dependency private to your project. Shared rules apply automatically.

๐Ÿ› ๏ธ Build and format

dotnet build

On each build, NetAgents:

  1. Formats your source files and applies available code fixes automatically.
  2. Checks the updated code against the shared rules.
  3. Reports any remaining violations as build errors for you to resolve.

Builds can change your source files. Every rewritten file is named in the build log, including when the build then fails on a violation no fix can repair. A build that would leave behind a violation it introduced changes nothing at all and says so instead. Review those changes before committing. Some violations require a manual fix; IDE quick fixes and dotnet format are also available.

Unchanged builds reuse completed formatting after checking a content fingerprint of the sources, dependencies, tools, and configuration. Policy checks and compiler enforcement remain enabled. Profile a build with dotnet-trace; dotnet clean discards the record when a full run is wanted.

๐Ÿ“ Formatting rules

  • Conditions: keep conditions on one line, with at most 128 characters. Extract longer expressions into separate variables. Ternary conditions follow this rule; their ? and : branches can span multiple lines.
  • Arguments and parameters: keep lists, collection expressions, and initializers on one line when their normalized contents fit within 128 characters, excluding the surrounding delimiters. Longer lists keep the first item beside the opening delimiter, put each later item on its own line one level deeper (one more for a list nested on the same line as another that continues), and close right after the last item; so does a list holding a lambda with several statements or a statement that holds others, such as if or try, one statement per line. This applies to calls and declarations, including constructors and records. A call's three or more arguments also wrap when the line they are on would pass 128 characters and no chain in the statement breaks it, and so do two arguments when the second is a lambda, a string, or a call; any other one or two arguments stay together unless something inside them would have to break instead. Collection expressions and collection and array initializers of two or more elements that do not fit put one element per line, with the brackets or braces on lines of their own and a trailing comma in a collection expression. Object initializers, with expressions, and anonymous objects always put one element per line.
  • Operators: keep &&, ||, and ?? sequences and ?: expressions on one line when they fit within 128 characters; otherwise put every operand after the first on its own line with its operator in front. A long line breaks at these operators before it breaks at a call's arguments, and at a call's arguments before it breaks inside one: an operator sequence in an argument stays on one line whole.
  • Member chains: keep a chain of up to four links (field, property, event, or method accesses) on one line when it fits within 128 characters, and however long the line gets when none of the links is a call. A longer chain, or one with a call that does not fit, keeps the first link on the receiver's line and puts every later link on its own line one level deeper; a first link whose call spans several lines goes on its own line too. An expression-bodied lambda starts its body on the line of its =>, and an assigned value starts on the line of its =.
  • Layout: use consistent spacing, blank lines between methods and around control flow and multiline declarations, statements grouped by kind with one blank line between groups and none inside them, a statement that fits within 128 characters written on one line, awaited values named before their members are read, a statement written over several lines standing alone, when on the line of the catch, case, or switch arm it guards, groups of at most four statements split by comments that say what each part is for, braces based on body layout, every brace and statement of a statement block on its own line, an unbraced body on its own line below its header, and a final newline.
  • Clarity: name literal, interpolated string, and collection expression arguments, pass every other argument positionally, and remove unused imports. Merge a try that only adds a finally into the try it wraps, write strings joined with + on one line as one string, compare with string literals as value is "literal", assign lambdas and method groups directly instead of through a delegate constructor, and write an interpolated string without string.Create(CultureInfo.InvariantCulture, โ€ฆ) when no culture can change what its holes print.

๐Ÿ—‚๏ธ Member order

Members are sorted by kind, visibility, const/static/instance, members fixed at construction before settable ones, constants by type, then name. Nested classes follow methods. Overloads with matching sorting keys retain their relative order.

Blank lines follow the same groups: single-line fields, properties, and events of one kind and visibility sit together, one blank line separates groups, and methods and documented or multiline members stand alone. A comment line starts a new group and keeps the members written under it together, and a group of more than four members needs comments saying what each part is for.

Sorting keeps the order of initializers that run code or read other members, and the field and property order of structs, explicit layouts, and serialized types. Types containing preprocessor directives retain their member order. A member wrapped at = or => that fits within 128 characters is joined onto one line.

โœ… Code standards

Area What to expect
๐Ÿงฉ Type safety Nullable analysis is required. No boxing, object/dynamic values, or untyped collections. Numeric casts such as (int)value are written with CreateChecked, CreateSaturating, or CreateTruncating, and the build rewrites existing ones; implicit conversions are left alone.
๐Ÿ—๏ธ Design Return dedicated named records, classes, or structs instead of tuple result types, including wrapped tuple results. Lambdas with one inferred parameter drop the optional parentheses.
๐Ÿท๏ธ Naming and structure Descriptive names and no placeholder locals such as result, flag, or isConditionMet, method names that do not repeat their first parameter, imported type names instead of qualified ones, one top-level type per matching file, files under 1,000 lines not counting comment lines, and at most 16 authored C# files per directory.
๐Ÿ“ Documentation Hand-written documentation that tells a reader what the name cannot: every public and protected member documents each parameter, type parameter, result, value, and exception it throws, with <remarks> and <example> code where usage is not obvious. Tags fit the member, say different things, end their sentences, write null, true, and false as <see langword="โ€ฆ"/>, and open property and constructor summaries the .NET way. One <summary> per documentation comment.
๐Ÿ›ก๏ธ Reliability Consume return values. No discarded results, empty catches, null-forgiving operators, or unconditional loops. Required rules cannot be suppressed, by pragma, attribute, configuration, or project setting.
โšก Concurrency Use asynchronous composition or Nito.AsyncEx for coordination. No lock, framework synchronization primitives, or blocking waits.
๐Ÿ“– Documentation XML comments are required for public APIs.

C# written in Razor components and views (@code, @functions, and @{ } blocks, and event-handler lambdas) meets the type-safety, descriptive-name, reliability, concurrency, and tuple-result rules too. Formatting rules and fixes apply to .cs files.

Existing editor and project settings must agree with the shared rules. See the complete rule reference for details.


๐Ÿ“ฆ NuGet package ยท ๐Ÿ“– Rule reference ยท โš–๏ธ MIT license

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
26.11.20.3876 773 11/20/2026
26.11.20.3628 64 11/20/2026
26.11.16.2138 822 11/16/2026
26.11.15.8158 269 11/15/2026
26.11.15.7976 153 11/15/2026
26.11.15.5457 341 11/15/2026
26.11.15.5231 118 11/15/2026
26.11.15.4281 193 11/15/2026
26.11.14.7153 203 11/14/2026
26.11.14.6890 124 11/14/2026
26.11.14.6710 103 11/14/2026
26.11.14.6596 120 11/14/2026
26.11.13.4341 206 11/13/2026
26.11.13.4170 121 11/13/2026
26.11.13.3791 136 11/13/2026
26.11.13.3279 154 11/13/2026
26.11.13.3216 118 11/13/2026
26.11.13.3130 101 11/13/2026
26.11.13.2937 127 11/13/2026
26.11.13.2538 107 11/13/2026
Loading failed