DrillPress.Testing 0.0.6

dotnet add package DrillPress.Testing --version 0.0.6
                    
NuGet\Install-Package DrillPress.Testing -Version 0.0.6
                    
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="DrillPress.Testing" Version="0.0.6" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="DrillPress.Testing" Version="0.0.6" />
                    
Directory.Packages.props
<PackageReference Include="DrillPress.Testing" />
                    
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 DrillPress.Testing --version 0.0.6
                    
#r "nuget: DrillPress.Testing, 0.0.6"
                    
#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 DrillPress.Testing@0.0.6
                    
#: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=DrillPress.Testing&version=0.0.6
                    
Install as a Cake Addin
#tool nuget:?package=DrillPress.Testing&version=0.0.6
                    
Install as a Cake Tool

Drill Press

Drill Press checks C# projects for coding-convention violations. It is designed for AI coding assistants: compact results identify the rule, file, and location to change, without pages of repeated messages.

Versions

All 0.0.X releases are experimental and may introduce breaking changes. Release tags also support explicit NuGet prereleases such as 1.0.0-rc.1. Pushing a version tag publishes all six packages after release validation; see the release process. Pin the tool and all Drill Press SDK packages to the same exact version. Before upgrading, check the release's compatibility notes and rebuild your rule bundles.

Install packages

The managed tool requires a .NET 10 SDK and bundles its matching BuildHost. It also checks solutions whose global.json selects the .NET 11 SDK: BuildHost then runs on the .NET 11 runtime that comes with that SDK. Rule bundles stay on net10.0, so the .NET 10 runtime must remain installed. The commands below apply after 0.0.1 is published to nuget.org. Before publication, follow the local artifact instructions. From your consuming repository:

dotnet new tool-manifest -o .config
dotnet tool install DrillPress.Cli --version 0.0.1
dotnet tool run drillpress -- --version

Commit .config/dotnet-tools.json; subsequent checkouts run dotnet tool restore. For a global installation, use dotnet tool install --global DrillPress.Cli --version 0.0.1. The SDK packages are DrillPress.RuleAuthoring, DrillPress.Engine, and the optional existing DrillPress.Testing kit; DrillPress.Manifest is transitive. Packages use the MIT license; the intended public feed is nuget.org. See package references, compatibility, packing, and publication for the minimal consumer project and isolated-feed validation.

Preview capabilities

Drill Press is an experimental .NET lint-rule engine. Commands and APIs may change. The sample bundle includes five general preview rules covering xUnit test structure, interface implementations, empty strings, and ordinal comparers, plus configured codec examples. Eligible corrections are marked with +. Use fix in place of check to apply them and report only remaining findings. Read the write and recovery policy before applying changes.

Start with the Windows and Linux fresh-checkout guide for Release builds, managed/native execution, all target shapes, and the preview acceptance gates.

Install from source

Writing your own conventions? Start with the rule author’s manual. Open user-docs/index.html in a browser for the searchable, offline HTML guide, including examples, an API field guide, and light/dark themes. Coding agents can install the bundled rule-authoring skill to write rules, fixes and tests without online documentation. Repository maintenance and acceptance-gate documentation remains in docs/.

Install Git and a .NET 10 SDK, then clone and build the repository. A specific SDK patch or feature-band build is not required; see global.json for SDK selection:

git clone https://github.com/MortenChristiansenOrg/drill-press.net.git
cd drill-press.net
dotnet build DrillPress.slnx

The SDK version in global.json is a minimum, not an exact pin. latestMinor roll-forward selects the highest installed .NET 10 SDK at or above 10.0.100, including newer feature bands and patches, without rolling forward to .NET 11. CI installs the .NET 10 channel (10.x) rather than the minimum build, and the .NET 11 channel (11.x) for the tests that load a target on SDK 11.

Source builds can run the tool directly as shown below. Installed tools locate their packaged BuildHost automatically.

Try it

From the repository root, run the included rule against the sample project:

dotnet restore "Sample Solution/src/WidgetLibrary/WidgetLibrary.csproj"
dotnet src/DrillPress.Cli/bin/Debug/net10.0/DrillPress.Cli.dll check --build-host src/DrillPress.BuildHost/bin/Debug/net10.0/DrillPress.BuildHost.dll --rules samples/DrillPress.SampleRules "Sample Solution/src/WidgetLibrary/WidgetLibrary.csproj"

This source-build example selects the project loader with --build-host. Installed tools need only --rules and the target; --build-host remains an explicit override for development. --rules takes a rules project or its directory, which the CLI restores and builds in Release on each run, or a compiled rule DLL or native bundle.

Expected output:

DP1003 Remove interfaces with exactly one concrete non-test implementation.
Sample Solution/src/WidgetLibrary/Contracts.cs
  3:18
DP1004 Use the empty string literal "" instead of string.Empty.
Sample Solution/src/WidgetLibrary/Contracts.cs
  +10:29
DP1005 Avoid passing StringComparer.Ordinal.
Sample Solution/src/WidgetLibrary/WidgetService.cs
  7:43

The +10:29 location offers a safe correction on line 10, column 29. To check your own C# project, replace the final argument with the path to its .csproj file.

To give developers, coding agents and CI the same check, commit a drillpress.json with the rules source, target, MSBuild properties, rule selection and reporting exclusions; drillpress check then needs no arguments, from any subdirectory. --select, --ignore and --exclude choose rules by ID and leave paths such as vendored code or rule projects out of reporting, while that code still informs analysis. See repository setup for discovery, precedence, exceptions, and the local and CI workflow.

Change-aware rules compare the code with an accepted state. Pass a Git revision of the targets' repository, or a directory holding an accepted copy of the current directory, with --baseline. For example, --baseline origin/main makes the sample's SDK2013 rule flag CodecExamples* projects' *.Legacy.cs files added since origin/main. The CLI resolves the revision; rules receive only a SourceBaseline.

A clean check prints nothing and exits with code 0. With --skip-coverage, rules that need test coverage are not evaluated and a final line lists them. Review-only findings also exit with code 0, with visible output. Violations produce code 1, including the example above. Code 2 means the check could not complete, such as when a project cannot be loaded. check reports violations without applying fixes.

status takes the same options and prints only counts: one line per project with its total violations, followed by a line per fix complexity. Projects are relative paths, so a line can be passed back as a check or fix target. A location that several projects report, such as a linked file, counts in each. File and glob targets have no project, so their counts are listed per source file. Review findings are not counted, and exit codes match check. Projects that the rule bundle excludes with RuleCatalog.ExcludeProjects, or whose files are all excluded with --exclude, report nothing, so they are not listed.

src/App/App.csproj 42
  trivial 30
  local 9
  unspecified 3

To accept a single finding where a convention does not fit, add a comment naming the rule and the reason: // drillpress-allow BR7-skip: the export pages a fixed snapshot. After code it allows findings on its line; on its own line it allows the statement or declaration below it. Allowed findings are not printed, counted or fixed. Allowances that allow nothing, or that lack a reason or name an unknown rule, are reported as drillpress-allow-unused (with a fix that removes them) and drillpress-allow-invalid. See allowing individual findings. Scoped and bulk suppression is tracked in #28; see exceptions for the other ways to make one.

The CLI captures and validates a versioned internal bundle response before writing public diagnostics. Direct bundle execution (<bundle> check <snapshot>) is an internal JSON protocol, not another public diagnostic format. Use matching CLI, BuildHost, and rule-bundle package versions. Snapshot format 6 records analysis scope and build overrides; response protocol 11 carries per-occurrence evidence, optional rule fix complexity, skipped coverage rules, why proposed fixes were withheld, and file moves. The CLI passes rule selection and reporting exclusions to the bundle as check options; exact version matching keeps the two sides in step. The contracts bind responses to a unique request and preserve compilation and document identities. Captured child stdout is limited to 64 MiB and stderr to 8 MiB; exceeding either limit stops the child and fails the check before rendering diagnostics.

Public output is UTF-8 without a BOM, uses LF, and groups ordinally by rule and relative file path, then source span. Each rule's remediation appears once. A location is line or line:column (one-based physical UTF-16 coordinates), indented two spaces; + directly before the line number, as in +5:32, marks an agreed safe correction. Paths containing controls, quotes, or surrounding whitespace use JSON escaping. Runs with no findings emit nothing.

Rules can optionally estimate agent fix effort as Trivial, Local, Complex, or Architectural. Use --show-fix-complexity to include assigned levels once per rule, and --fix-complexity trivial,local to select findings and fixes. Include unspecified to select rules without metadata. Filtering also controls the findings exit code; default output and rule selection stay unchanged. See rule fix complexity for model routing.

Corrections are represented internally as complete edit batches tied to original byte fingerprints. All reporting contexts must agree and every affected loaded context must validate the complete batch, including contexts without a finding. Missing, inactive-source, or ambiguous-binding validation withholds the fix. Conflicting batches are withheld in full; independent fixes survive. Insertions conflict at either boundary of another edit when their order would be ambiguous. The renderer and fix writer consume the same validated plan. Fix validation covers the loaded project graph. fix applies retained edits and reports only remaining findings after rechecking; see the write and recovery workflow.

Snapshots contain source and machine-local paths. Rule bundles execute trusted code; protocol validation is not a sandbox. Native verification retains exact internal response bytes and public.stdout; its report records public UTF-8 bytes and a rough token estimate (bytes / 4, rounded up).

BuildHost accepts .sln, .slnx, .csproj, a directory, a C# file, or a single quoted C# glob. A directory selects its sole top-level solution, otherwise its sole C# project; ambiguity requires an explicit file. Globs use * for zero or more characters within a path segment, ? for one, and ** for recursive segments (**/ also matches no directories). Matching C# paths are deduplicated and ordinal-sorted. Pattern matching is case-sensitive on both platforms; recursive expansion skips symbolic links. Quote globs to keep the shell from expanding them.

A .csproj target (including a directory resolving to one) lints only that project, across its evaluated target frameworks. Dependencies remain loaded for semantic resolution and fix validation, but do not produce findings or receive fixes to dependency-only files. Pass --include-referenced-projects to check or fix to include direct and transitive project references. Solution targets retain analysis of the loaded project graph; loose-source targets retain their selected files.

Several targets, such as drillpress fix A.csproj B.csproj "tools/**/*.cs", run as one analysis: the rules build once, BuildHost loads every target in one session, and fix rechecks them all. Each target keeps the scope it has alone, and a file that several targets share reports once. Loose files that an analysed project already compiles are analysed in that project. A solution must be the only target, because MSBuild sets solution properties only for a solution it loads alone; check it on its own or list its projects. All project targets must select the same .NET SDK, and --baseline with a Git revision needs them in one repository.

Pass repeatable --property Name=Value options to override MSBuild global properties; the last assignment wins. --property TargetFramework=net10.0 selects a framework; otherwise every evaluated framework context is retained. The selected target's global.json controls SDK discovery, even when invoked from another directory. BuildHost loads exactly the SDK that dotnet selects there, and restarts on the newest installed runtime when that SDK belongs to a newer .NET than the one it runs on. SDK targets must already be restored: BuildHost does not restore or build them. Source-generator assemblies must also be available. Failures explain when to install an SDK or run dotnet restore.

Loose files and globs always use an ad hoc C# 15 library compilation, even inside a project. Nullable annotations and warnings are enabled, there are no preprocessor symbols or implicit usings, and references come from the BuildHost runtime's trusted platform assembly set (captured with byte fingerprints). MSBuild properties are rejected in loose mode. These defaults are deliberately independent of nearby project settings.

Fast export permits ordinary compiler errors. --validate-compilation explicitly enumerates compiler errors and rejects an invalid target. Like a real build, it applies the project's analyzer DiagnosticSuppressors first, so errors that packages suppress (such as EF Core's CS8618 on DbSet properties) do not fail it. Fix validation likewise ignores warnings reported as errors that a project suppressor can hide, unless an edit adds one. Like the target's own compiler, both modes skip analyzers and generators that reference a newer compiler than the target SDK runs; validation reports that as CS9057 with the project's configured severity. Generators receive additional files in MSBuild item order, as in a real build. Generator exceptions, missing inputs, incomplete project graphs, and load failures fail both modes; with several failed contexts, the first in snapshot order is reported, and the contexts after it that no earlier context references are cancelled. Semantic selections do not guess unresolved symbols; syntax queries retain erroneous code. Source project references remain compilation references, so an erroneous dependency need not emit an assembly. Generated source participates in binding but is excluded from reportable candidates and edits. Explicit evaluated IsTestProject values take precedence over inference.

Snapshots preserve physical source text, byte fingerprints, encoding/BOM, per-tree parse settings and compiler severities, compilation options, aliased metadata references, and the evaluated source graph. Reconstruction rejects changed or missing external metadata. Snapshots are sensitive, ephemeral files: the CLI uses a private temporary directory, writes atomically, and removes it on success, findings, failure, and cancellation. Unix snapshot files are created with owner-only read/write permissions. On Windows the CLI protects its temporary directory with inheritable access restricted to the current user before starting a child process.

Run compiler conformance:

dotnet build fixtures/CompilerSnapshot/Interop/Interop.csproj -c Release
dotnet build fixtures/CompilerSnapshot/Generator/Generator.csproj -c Release
dotnet build fixtures/CompilerSnapshot/Analyzers/Analyzers.csproj -c Release
dotnet restore fixtures/CompilerSnapshot/Selected.slnx
dotnet run --project tools/DrillPress.Conformance -c Release -- \
  fixtures/CompilerSnapshot/Selected.slnx artifacts/conformance/fixture.json

The compiler fixture compares live/reconstructed symbol bindings, conversions, declarations, compiler diagnostics, and current rule responses. This check also runs in the project's integration suite. The external xUnit repository harness has been removed; Drill Press's own unit and integration tests still use xUnit.

The CI workflow builds, packs, checks formatting, and runs the complete test suite once on Linux for each PR update and main push. Superseded runs are cancelled. Tagged releases additionally gate publication on Windows tests and managed/NativeAOT parity on both platforms. There are no scheduled workflows. See release validation.

See profiling for phase measurements on stderr during ordinary CLI checks and fixes with --profile.

See test-backed coverage requirements for transparent execution and line-threshold rules, conservative occurrence evidence, and report reuse.

See rule authoring for reusable queries, the five sample rules, semantic type identities, and the exact automatic-fix contracts. C# 15 unions in Drill Press covers rules that span several candidate types and target code written in C# 15.

The fix guides cover contextual expression proposals, argument, modifier and block edits, and grouping and extracting repeated expressions.

The composable SDK guide covers custom query roots, source and operation analysis, shared facts, project relationships, accepted source baselines, safe edit construction, and the consumer test kit. The codec example exercises the expanded API with independent architecture and source policies. Authoring types now live in the single DrillPress namespace, including queries, semantic facts and fix builders.

The base rules SDK contains general analysis, query, diagnostic, and edit APIs. The xUnit layout, single-implementation interface, empty-string, ordinal-comparer, and implicit-accessibility conventions belong entirely to the sample bundle. See the API migration guide when updating an earlier consumer.

Optional maintained LINQ declaration categories and sequence input roles are available in DrillPress.Linq; see the catalogue.

Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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
0.0.6 93 11/23/2026
0.0.4 108 11/14/2026
0.0.3 105 11/9/2026
0.0.3-preview.27 73 10/31/2026
0.0.3-preview.26 69 10/30/2026
0.0.3-preview.25 64 10/29/2026
0.0.3-preview.23 96 10/23/2026
0.0.3-preview.22 70 10/23/2026
0.0.3-preview.19 74 10/16/2026
0.0.3-preview.18 76 10/16/2026
0.0.3-preview.17 73 10/7/2026
0.0.3-preview.15 73 10/7/2026
0.0.3-preview.14 71 10/6/2026
0.0.3-preview.13 73 10/6/2026
0.0.3-preview.11 79 10/5/2026
0.0.3-preview.9 77 10/5/2026
0.0.3-preview.8 78 10/3/2026
0.0.3-preview.6 71 9/29/2026
0.0.3-preview.5 74 9/29/2026
0.0.3-preview.3 77 9/29/2026
Loading failed