Starting from VS2017, .editorconfig
files are taken into account and allow to override local preferences. Put it at the root of your projects solution (or even higher), under source control in order to distribute it with your sources to each developer.
You can set .Net coding conventions through VS (since v15.3) specific properties, documented here.
Example file:
root = true
[*]
end_of_line = CRLF
insert_final_newline = true
[*.cs]
indent_style = tab
dotnet_sort_system_directives_first = true
csharp_space_after_cast = true
[*.xsd]
indent_style = tab
[*.json]
indent_style = space
indent_size = 2
[*.xml]
indent_style = space
indent_size = 2
[*.cshtml]
indent_style = space
indent_size = 4
For VS2017, the IntelliCode experimental extension has a feature for generating editor config files, see this blog post for more information.
Starting from VS2019, VS can create an editorconfig file from "New File" templates, from your code base (right-click a project > Add > New EditorConfig) or from your current VS configuration (Tools > Options > Text Editor > [C# or Basic] > Code Style > General).