Webority.Build 0.37.0

There is a newer version of this package available.
See the version list below for details.
<Sdk Name="Webority.Build" Version="0.37.0" />
                    
For projects that support Sdk, copy this XML node into the project file to reference the package.
#:sdk Webority.Build@0.37.0
                    
#:sdk 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.

Webority.Build

Webority.Build is the fleet's build SDK. It carries the fleet build settings (nullable, warnings as errors, language version and the rest), the rule severities the fleet config states, the fleet rule check that fails the build with WBB codes when a repo departs from them, and the pack guard, which fails dotnet pack when a package would carry symbols, source or a repository link. The SDK pins the Webority.Analyzers package, so a repo takes its banned API and rule analyzers from the SDK and lists no Webority.Analyzers reference of its own.

Install

Pin the SDK in global.json, to the newest published version:

{
  "sdk": { "version": "11.0.100", "rollForward": "latestFeature" },
  "msbuild-sdks": { "Webority.Build": "<version>" }
}

Import the SDK's props as the first line inside <Project> in Directory.Build.props:

<Import Project="Sdk.props" Sdk="Webority.Build" />

Import the SDK's targets as the last line inside <Project> in Directory.Build.targets:

<Import Project="Sdk.targets" Sdk="Webority.Build" />

The repo also needs a .webority/settings.json at its root with a kind field; a folders entry's own kind wins over the repo's for the projects under that folder. Only "library" gets the packed-dependency upper bounds; a missing kind fails the build as WBB1009.

Migrate a repo

  1. global.json: add the msbuild-sdks pin above.
  2. Directory.Packages.props: delete the Webority.Analyzers PackageVersion. Directory.Build.props: delete the Webority.Analyzers PackageReference. The SDK pins and references the package.
  3. Add the two imports: Sdk.props as the first line of Directory.Build.props, and Sdk.targets as the last line of Directory.Build.targets.
  4. Directory.Build.targets: delete the build/Webority.PackGuard.targets import, and delete the file build/Webority.PackGuard.targets. The SDK's targets carry the pack guard.
  5. .editorconfig: delete each line whose key the SDK's global config sets. A lower value fails the build as WBB1003, and the same value as WBB1005. Keep the core options (indentation, line endings), any other key the SDK does not set, and a dotnet_diagnostic line that raises a severity above the SDK's value.
  6. Baselines: rename .webority/baselines/banned-api-baseline.txt to .webority/baselines/rule-baseline.txt with git mv. If the repo has .webority/baselines/analyzer-baseline.json, delete it and the WarningsNotAsErrors entries it backed.
  7. Exceptions: for each suppression you keep, add an entry to .webority/baselines/exceptions.json before seeding. Each entry is a JSON object with an id (EX-<n>), the rule it lowers, the paths it covers (repo-relative paths or folder globs), a reason, and the approvedBy work item. Only a person approves a new entry, and the nullable ids (WBA5001 to WBA5004) take no entry. Register each kept suppression before the seed build, because WBB1002 fails a NoWarn or WarningsNotAsErrors rule that no entry covers. An inline suppression also names its EX id on its line.
  8. Seed the baseline, as described below.
  9. Build, and fix each WBB error listed under Build errors.

Seed the baseline

Run the seed build, then the script that writes the baseline from its log:

DOTNET_CLI_UI_LANGUAGE=en dotnet build <Repo>.slnx --no-incremental -p:WeboritySeedBaseline=true -v q --nologo > build.log 2>&1
node <webority-analyzers>/scripts/baseline-from-build.mjs build.log

WeboritySeedBaseline keeps banned API hits (RS0030) as warnings for this one build, so every project compiles and lands in the log. The nullable rules stay errors. Never set TreatWarningsAsErrors off instead: that fails the build as WBA5004.

The script writes .webority/baselines/rule-baseline.txt with the exact count per file and key. Commit the file. From then on the normal build passes, and any new hit fails it. The script writes a new file only, and exits 1 when the log holds an error the baseline cannot hold.

A repo that already has a baseline records new hits with --add, after the same seed build:

node <webority-analyzers>/scripts/baseline-from-build.mjs build.log --add

No count goes down under --add. Lowering a count is the change that removes the hits. Build and run --add again until the log shows no hit the baseline can hold.

Build errors

The SDK checks the fleet build settings and rule severities before each .NET project compiles, and fails the build with one of these codes:

  • WBB1001: a project or props file sets a fleet build setting to another value. Remove the setting; the SDK sets it.
  • WBB1002: NoWarn or WarningsNotAsErrors names a rule that no register entry covers. Fix the code, or register the rule for those paths as an exception.
  • WBB1003: a repo .editorconfig or global config sets a fleet key to a lower value, or sets a dotnet_diagnostic severity below warning, with no register entry. Delete the line, or register it.
  • WBB1009: .webority/settings.json has no kind field. Add it: "library" for a repo that publishes packages (the SDK caps its Webority dependencies below their next breaking line; a product that pins exact [x.y.z] versions is not a library), or "product", "tool", "mobile-app" or "website".
  • WBB1004: the register or the baseline cannot be read, or holds an entry that matches nothing. Fix the file, or delete the entry that matches nothing.
  • WBB1005: a repo .editorconfig or global config repeats a key the SDK sets, at the same value. Delete the line; no register entry passes it.
  • WBB1006: a project references Webority.Analyzers without the SDK. Migrate the repo; no register entry passes it.
  • WBA1002: a #pragma warning disable or SuppressMessage has no register entry covering its file and no baseline count left for it. Fix the code, or add an EX entry that covers the file and name its id on the suppression's line.

A registered exception passes one of the WBB errors above. While an entry covers the project or file, the error for its rule does not fire. A path naming a Directory.Build.props or Directory.Build.targets covers every project in that file's folder and below, so a suppression set in a shared build settings file is registered once.

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
0.39.3 311 11/19/2026
0.39.2 200 11/19/2026
0.39.1 116 11/19/2026
0.39.0 156 11/19/2026
0.38.2 232 11/19/2026
0.38.1 139 11/19/2026
0.38.0 320 11/18/2026
0.37.0 171 11/18/2026
0.36.0 10,229 11/16/2026
0.35.0 10,478 11/15/2026
0.34.1 3,950 11/15/2026
0.34.0 96 11/15/2026
0.33.0 2,402 11/15/2026
0.32.0 4,350 11/15/2026
0.31.0 860 11/14/2026
0.30.4 288 11/14/2026
0.30.3 806 11/14/2026
0.30.2 702 11/14/2026
0.30.1 4,938 11/14/2026
0.30.0 1,023 11/14/2026
Loading failed