It's important that the code in a project is kept consistent. This is hard to do when you have developers working in different environments.
Using a .editorconfig file is the best way to manage this.
See the EditorConfig file specification
Most IDEs will automatically find and use a .editorconfig file to format code.
See Keep your code clean, automatically!.
✅ Figure: Good example - Project using a ".editorconfig" file
❌ Figure: Bad example - Project using StyleCop (old)
In VS 2022
Figure: Creating .editorconfig in VS 2022
Manually
To ensure your team is following this standard, you can add it to your Definition of Done.
Additionally, you can have a PR check that enforces .editorconfig rules, but its always better to do this locally.
Learn more on: