PinguApps.RazorStyle.Cli 0.1.0

There is a newer version of this package available.
See the version list below for details.
dotnet tool install --global PinguApps.RazorStyle.Cli --version 0.1.0
                    
This package contains a .NET tool you can call from the shell/command line.
dotnet new tool-manifest
                    
if you are setting up this repo
dotnet tool install --local PinguApps.RazorStyle.Cli --version 0.1.0
                    
This package contains a .NET tool you can call from the shell/command line.
#tool dotnet:?package=PinguApps.RazorStyle.Cli&version=0.1.0
                    
nuke :add-package PinguApps.RazorStyle.Cli --version 0.1.0
                    

RazorStyle

RazorStyle is an opinionated Razor style linter and enforcer for Blazor .razor files. It exists to make Razor markup consistent across a solution, either by checking files in CI or fixing files during local builds.

It is distributed as two packages:

  • PinguApps.RazorStyle.Cli: a .NET tool named razorstyle.
  • PinguApps.RazorStyle: an MSBuild integration package that runs RazorStyle during builds.

Rules

  • RS0001: start-tag attributes must wrap and align consistently.
  • RS0002: child content must appear on its own line.
  • RS0003: attributes must follow the preferred RazorStyle order.

RS0001 Attribute Wrapping

Before:

<Modal Title="Hello" IsOpen="true" OnClose="Close" />

After:

<Modal Title="Hello"
       IsOpen="true"
       OnClose="Close" />

Single-attribute and attribute-free tags remain inline:

<Modal />
<Modal Title="Hello" />

RS0002 Child Content Lines

Before:

<span>Some text</span>

After:

<span>
    Some text
</span>

Self-closing tags are already valid:

<span />
<span class="foo" />

RS0003 Attribute Order

Before:

<button data-track="save" disabled class="btn" @onclick="Save" id="save-button" />

After:

<button id="save-button"
        class="btn"
        @onclick="Save"
        data-track="save"
        disabled />

CLI Usage

Install the tool:

dotnet tool install --global PinguApps.RazorStyle.Cli

Check files:

razorstyle check .\src

Fix files:

razorstyle fix .\src

Build Integration

Install the build package into a project that contains .razor files:

dotnet add package PinguApps.RazorStyle

By default:

  • local builds run fix
  • CI builds run check when ContinuousIntegrationBuild=true

Override behavior with MSBuild properties:

<PropertyGroup>
  <RazorStyleEnabled>true</RazorStyleEnabled>
  <RazorStyleCommand>check</RazorStyleCommand>
  <DisableRS0001>false</DisableRS0001>
  <DisableRS0002>false</DisableRS0002>
  <DisableRS0003>false</DisableRS0003>
</PropertyGroup>

The CLI also supports per-rule disables:

razorstyle check .\src --disable RS0001 --disable RS0003
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.

This package has no dependencies.

Version Downloads Last Updated
2.0.0 108 5/31/2026
1.0.0 110 5/2/2026
0.1.0 111 5/2/2026