Skip to content

messerli-informatik-ag/code-style

Repository files navigation

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'
 # ...

About

Shared lint/code style config for C# projects

Resources

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
license_apache.txt
MIT
license_mit.txt

Stars

Watchers

Forks

Packages

No packages published

Contributors 8