I'm confused: why are you linting code in CI, rather than as a precommit hook?
I see precommit hooks as where you avoid the low-hanging fruit, like “is this code actually parsable?”
(Unlike most formatters which are instant, dotnet format takes at least half a minute, because it performs a build just to format your code.)