PinguApps.RazorStyle 0.1.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package PinguApps.RazorStyle --version 0.1.0
                    
NuGet\Install-Package PinguApps.RazorStyle -Version 0.1.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="PinguApps.RazorStyle" Version="0.1.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="PinguApps.RazorStyle" Version="0.1.0" />
                    
Directory.Packages.props
<PackageReference Include="PinguApps.RazorStyle" />
                    
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 PinguApps.RazorStyle --version 0.1.0
                    
#r "nuget: PinguApps.RazorStyle, 0.1.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 PinguApps.RazorStyle@0.1.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=PinguApps.RazorStyle&version=0.1.0
                    
Install as a Cake Addin
#tool nuget:?package=PinguApps.RazorStyle&version=0.1.0
                    
Install as a Cake Tool

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
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.0.0 267 5/31/2026
1.0.0 497 5/2/2026
0.1.0 149 5/2/2026