Adliance.Buddy.CodeStyle 8.0.0.8

Prefix Reserved
dotnet add package Adliance.Buddy.CodeStyle --version 8.0.0.8                
NuGet\Install-Package Adliance.Buddy.CodeStyle -Version 8.0.0.8                
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="Adliance.Buddy.CodeStyle" Version="8.0.0.8" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Adliance.Buddy.CodeStyle --version 8.0.0.8                
#r "nuget: Adliance.Buddy.CodeStyle, 8.0.0.8"                
#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.
// Install Adliance.Buddy.CodeStyle as a Cake Addin
#addin nuget:?package=Adliance.Buddy.CodeStyle&version=8.0.0.8

// Install Adliance.Buddy.CodeStyle as a Cake Tool
#tool nuget:?package=Adliance.Buddy.CodeStyle&version=8.0.0.8                

Adliance.Buddy.CodeStyle

This package is used to distribute a common .editorconfig file. During the build an .editorconfig file is copied from the nuget package to the project folder.

Usage

Add a Directory.Build.props file to your solution root with the following content. Replace the version by the desired nuget package version. Now the Nuget package will be installed to all projects. Alternatively the nuget package can also be directly installed in each project if desired.

<Project> 
  <PropertyGroup>
    <EnforceCodeStyleInBuild>true</EnforceCodeStyleInBuild> 
  </PropertyGroup>
  <ItemGroup>
    <PackageReference Include="Adliance.Buddy.CodeStyle" Version="1.0.0">
      <PrivateAssets>all</PrivateAssets>
      <IncludeAssets>runtime; build; native; contentfiles;analyzers</IncludeAssets>
    </PackageReference>
 </ItemGroup>
</Project>

The copied .editorconfig files from the nuget package should be ignored via your .gitignore file.

dotnet format

The dotnet format command also picks up the .editorconfig files.

It can be used to format and apply fixes automatically wherever possible.

dotnet format --verify-no-changes can be used to verify if there are potential issues or not.

https://learn.microsoft.com/en-us/dotnet/core/tools/dotnet-format

EnforceCodeStyleInBuild

When the CodeStyle is enforced during build the warnings/errors are only displayed on clean builds.

Possibility for clean builds:

  • use dotnet clean before dotnet build
  • delete bin and obj directories
  • dotnet build --no-incremental

Incremental builds do not show any warnings/errors as the build is potentially cached locally.

CI

The .editorconfig files must be in place in all project directories before formatting/building in a CI environment to ensure it is picked up correctly.

This can be done for each project with these commands:

  1. restore all packages with dotnet restore
  2. execute the target from the nuget package manually to copy the .editorconfig file dotnet msbuild /t:CopyEditorConfig

This can be executed like this in an Azure DevOps Pipeline:

steps:
  - task: DotNetCoreCLI@2
    displayName: 'Restore'
    inputs:
      command: restore
      projects: '**/*.csproj'
  - task: DotNetCoreCLI@2
    displayName: 'CopyEditorConfig'
    inputs:
      command: custom
      custom: 'msbuild'
      arguments: '/t:CopyEditorConfig'
      projects: '**/*.csproj'`
  - task: DotNetCoreCLI@2
    displayName: 'Lint'
    inputs:
      command: custom
      projects: '**/*.csproj'
      custom: format
      arguments: '-v d --verify-no-changes'
Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net8.0

    • No dependencies.

NuGet packages (11)

Showing the top 5 NuGet packages that depend on Adliance.Buddy.CodeStyle:

Package Downloads
Adliance.AspNetCore.Buddy.Pdf

Library of utility methods and common functionality that are useful for most Adliance projects.

Adliance.AspNetCore.Buddy.Email.Mailjet

Library of utility methods and common functionality that are useful for most Adliance projects.

Adliance.OtysClient

Package Description

Adliance.Storyblok

Easily integrate the Storyblok headless CMS into your ASP.NET core application.

Adliance.AspNetCore.Buddy.Email.SendGrid

Library of utility methods and common functionality that are useful for most Adliance projects.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
8.0.0.8 4,217 7/25/2024
8.0.0.7 3,666 7/2/2024
8.0.0.6 218 6/24/2024
8.0.0.5 2,711 3/15/2024
8.0.0.2 105 6/24/2024
8.0.0.1 119 4/11/2024
7.0.0.11 2,936 11/22/2023
7.0.0.10 142 11/20/2023
7.0.0.6 224 10/25/2023
7.0.0.5 154 10/23/2023
7.0.0.4 3,277 8/21/2023
7.0.0.3 170 8/21/2023
7.0.0.2 442 6/26/2023