Jonathan Allen
Jonathan Allen

Reputation: 70337

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.

Upvotes: 4

Views: 2249

Answers (2)

lucccas
lucccas

Reputation: 47

For Visual Studio 2022

  1. Tools --> Options
  2. Text Editor --> C# --> Tabs

Upvotes: -1

maccettura
maccettura

Reputation: 10819

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.

Upvotes: 7

Related Questions