This extension provide a task for checking or fixing code format, style and analyzer configuration using dotnet-format.
Warning
⚠️ The project is still under development.⚠️ Expect breaking changes until v1.
| Requirement | Min. version |
|---|---|
| ADO API | rest-7.1 0 |
| ADO Agent | 2.206.1 (node v16.x) |
- .NET or .NET Core installed, see Use .NET Core task
- Either:
- .NET 6 / 7 / 8 SDK, using
dotnet format - .NET Global tool
dotnet-formatinstalled and accessible from the path
- .NET 6 / 7 / 8 SDK, using
Setup pre-release, beta or specific version of
dotnet-formatfrom dnceng feeds.
- task: UseDotNetFormat@0
displayName: 'setup-format feed'
inputs:
publicFeedServiceConnection: PublicDnceng
feed: dotnet9
definition: '54f95428-cc3a-48e0-b6a2-80280b31ba03'
version: 9.0.507701Run
dotnet formatordotnet-formatto validate your code.
Feature:
- check (aka
verify-no-changes) - fix (aka
format) - custom command
Only touched files:
- Git (full checkout or ADO-API)
- TFVC
- SVN
- task: DotNetFormatCLI@0
displayName: "dotnet format"
continueOnError: true # recommended if using ReportReviewer
inputs:
useGlobalTool: false
command: 'check'
workspace: 'YourSolution.sln'
onlyChangedFiles: true #PR mode
verbosity: Normal
diffProvider: api # `native` using full checkout or `api` using ADO-API
fileGlobPatterns: |
*.cs
*.vb
excludes: |
/src/Project/FileToExclude.cs
env:
SYSTEM_ACCESSTOKEN: $(System.AccessToken) # required for ADO-APIComment an active Azure DevOps PullRequest with previous generated report.
Target:
- Azure DevOps Service
- Azure DevOps Server
- Github
- Github Enterprise Server
- Bitbucket Cloud
- Bitbucket Server
- task: ReportReviewer@0
displayName: "dotnet format reporting"
inputs:
connectedServiceName: 'FormatReviewer'
spamThreshold: 5If you have feedback or issues, please file an issue on GitHub.





