Skip to content

Latest commit

 

History

History
53 lines (44 loc) · 1.63 KB

readme.md

File metadata and controls

53 lines (44 loc) · 1.63 KB

Messerli Code Style

Build NuGet Coding Guidelines

Usage

Add the following package reference to your project or to your Directory.Build.props:

  <?xml version="1.0" encoding="utf-8"?>
  <Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+     <ItemGroup>
+         <PackageReference Include="Messerli.CodeStyle" PrivateAssets="all" />
+     </ItemGroup>
  </Project>

You either have to add the version here or in Directory.Packages.props depending on if you're using Central Package Management.

Warnings as Errors

Some analyzer rules, such as rules involving single line comments, are configured as warnings to facilitate development. To enforce these rules, enable TreatWarningsAsErrors for CI builds.

- dotnet build --no-restore
+ dotnet build --no-restore /p:TreatWarningsAsErrors=true

Github Actions

 jobs:
   build:
     steps:
     # ...
     - name: Build
-      run: dotnet build --no-restore
+      run: dotnet build --no-restore /p:TreatWarningsAsErrors=true
     # ...

Azure Devops

 steps:
 # ...
 - task: DotNetCoreCLI@2
   displayName: Build
   inputs:
-    arguments: '--no-restore'
+    arguments: '--no-restore /p:TreatWarningsAsErrors=true'
 # ...