Search code examples
c#visual-studio-2017

How can I set tabs for Visual Studio solution?


My defaults for Visual Studio are "keep tabs" and "4 spaces".

But for one C# solution the format command always replaces the tabs with 2 spaces. Only the one solution is affected and I don't see any settings that actually say "2 spaces".

This is affecting another developer (different set of plugins) working on the same solution, so it's got to be a setting somewhere in the project or solution itself. But I can't think of anywhere else to look.


Solution

  • Visual Studio 2017 introduced a feature that lets you use the open source "EditorConfig" format to change editor configurations on a "per solution" basis.

    You should see a file called .editorconfig in your directory. In there you can see all sorts of settings, I believe the ones you are looking for are:

    indent_style = space
    indent_size = 2
    

    You can then remove or change depending on your need.