Skip to content
| Marketplace
Sign in
Azure DevOps>Azure Pipelines>dotnet-format
dotnet-format

dotnet-format

Herve-M

|
15 installs
| (0) | Preview
Azure Pipelines task helper around dotnet-format
Get it free

ados-dotnetformat

This extension provide a task for checking or fixing code format, style and analyzer configuration using dotnet-format.

Disclaimer

[!WARNING]

  • ⚠️ The project is still under development.
  • ⚠️ Expect breaking changes until v1.

How to use

Compatibility matrix

Requirement Min. version
ADO API rest-7.1
ADO Agent 3.227.1 (node v20.x)

Pre-requisites

  • .NET or .NET Core installed, see Use .NET Core task
  • Either:
    • .NET 6 / 7 / 8 / 9 / 10 SDK, using dotnet format
    • .NET Global tool dotnet-format installed and accessible from the path

Tasks

UseDotNetFormat

[!NOTE] dotnet-format is included in the SDK since .NET 6, use this task only if you want to pin a specific version and/or try out dev-build.

Setup pre-release, beta or specific version of dotnet-format from dnceng feeds.

use-task use-overview

- task: UseDotNetFormat@1
  displayName: 'setup-format feed'
  inputs:
    publicFeedServiceConnection: PublicDnceng
    feed: dotnet9
    definition: '54f95428-cc3a-48e0-b6a2-80280b31ba03' # dotnet-format nuget ID
    version: 9.0.507701

DotNetFormatCli

Run dotnet format or dotnet-format to validate your code.

Feature:

  • [X] check (aka verify-no-changes)
  • [ ] fix (aka format)
  • [ ] custom command

Only touched files (onlyChangedFiles: true, Azure DevOps Git only):

  • [X] Git (full checkout)
  • [X] Azure DevOps (git) (full checkout or API)
  • [ ] TFVC
  • [ ] SVN

format-task format-overview

# Baseline: check all files
- task: DotNetFormatCLI@1
  displayName: "dotnet format check"
  continueOnError: true # recommended when using ReportReviewer
  inputs:
    command: 'check'
    workspace: 'YourSolution.sln'
    verbosity: Normal
# PR mode: check only changed files
# Requires Build.Reason = PullRequest; only Azure DevOps Git is supported
- task: DotNetFormatCLI@1
  displayName: "dotnet format check (PR)"
  continueOnError: true # recommended when using ReportReviewer
  inputs:
    command: 'check'
    workspace: 'YourSolution.sln'
    onlyChangedFiles: true
    diffProvider: api   # `native` requires full (non-shallow) checkout
    fileGlobPatterns: |
      *.cs
      *.vb
    excludes: | 
      /src/Project/FileToExclude.cs
    verbosity: Normal
  env:
    SYSTEM_ACCESSTOKEN: $(System.AccessToken) # required for ADO-API

ReportReviewer

Comment an active Azure DevOps PullRequest with previous generated report.

Target:

  • [X] Azure DevOps Service
  • [X] Azure DevOps Server
  • [ ] Github
  • [ ] Github Enterprise Server
  • [ ] Bitbucket Cloud
  • [ ] Bitbucket Server

reviewer-task reviewer-overview

- task: ReportReviewer@1
  displayName: "dotnet format reporting"
  inputs:
    connectedServiceName: 'FormatReviewer'  # type: Azure DevOps auth. (report reviewer)
    minSeverityLevel: 'warning'             # error | warning | info
    spamThreshold: 5                        # issues per file before grouping into a single thread
  env:
    SYSTEM_ACCESSTOKEN: $(System.AccessToken) # required when auth-scheme-none is used

[!NOTE] Only works within a PullRequest build on an Azure DevOps Git repository. The task reads the report from $(Build.ArtifactStagingDirectory)/CodeAnalysisLogs/format.json produced by DotNetFormatCLI.

Feedback and issues

If you have feedback or issues, please file an issue on GitHub.

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2026 Microsoft