Skip to content

lvlup-sw/lvlup-build

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Lvlup.Build

Levelup Software build standards, analyzers, and code style enforcement for .NET projects.

Overview

Lvlup.Build is a NuGet meta-package that provides:

  • Analyzers: StyleCop, Microsoft .NET Analyzers, and Visual Studio Threading Analyzers
  • Build Properties: Consistent settings for nullable reference types, warnings-as-errors, and deterministic builds
  • Override Points: Easy customization for project-specific needs

Installation

Add to your Directory.Build.props:

<ItemGroup>
  <PackageReference Include="Lvlup.Build" PrivateAssets="all" />
</ItemGroup>

And to your Directory.Packages.props:

<ItemGroup>
  <PackageVersion Include="Lvlup.Build" Version="1.0.0" />
</ItemGroup>

What's Included

Analyzers

Package Version Purpose
StyleCop.Analyzers 1.2.0-beta.556 Code style and formatting
Microsoft.CodeAnalysis.NetAnalyzers 10.0.0 Code quality and .NET best practices
Microsoft.VisualStudio.Threading.Analyzers 17.14.15 Async/threading correctness

StyleCop Configuration

The package includes a default stylecop.json that is automatically linked to your projects. To override:

  1. Add your own stylecop.json to your src/ directory
  2. Or disable the default: <LvlupIncludeStyleCopConfig>false</LvlupIncludeStyleCopConfig>

Build Properties

The package automatically configures:

  • LangVersion: latest
  • ImplicitUsings: enable
  • Nullable: enable
  • EnableNETAnalyzers: true
  • AnalysisLevel: latest
  • TreatWarningsAsErrors: true
  • Deterministic: true

Override Points

Customize behavior by setting properties before the package is imported:

<!-- In your Directory.Build.props -->
<PropertyGroup>
  <!-- Disable warnings-as-errors for Debug builds -->
  <LvlupTreatWarningsAsErrors Condition="'$(Configuration)' == 'Debug'">false</LvlupTreatWarningsAsErrors>

  <!-- Disable all analyzers (not recommended) -->
  <LvlupEnableAnalyzers>false</LvlupEnableAnalyzers>

  <!-- Disable nullable reference types -->
  <LvlupEnableNullable>false</LvlupEnableNullable>

  <!-- Don't run analyzers during build (IDE only) -->
  <LvlupRunAnalyzersDuringBuild>false</LvlupRunAnalyzersDuringBuild>
</PropertyGroup>

Companion Configuration

For full code style enforcement, pair this package with:

  1. .editorconfig - Code formatting rules and analyzer severities
  2. stylecop.json - StyleCop-specific settings (company name, documentation rules)

Templates for these files are available via the /dotnet-standards Claude skill:

/dotnet-standards scaffold MyProject --company "My Company"

Installation

This package is published to nuget.org. No special configuration needed.

License

MIT

About

Standards, analyzers, and code style enforcement for .NET projects

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors