Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Use tabs instead of spaces in .csproj file in Visual Studio 2022

When I'm creating a new project file, it generates a new .csproj file where single tabs are replaced with two spaces.

default behaviour

I can manually replace them through Edit->Advanced->Format Document (Ctrl+E, D), but I want to make it automatically when I'm creating a new one.

wished behaviour

I tried to mess with tabs in options, but it's not working. How can I make it work?

like image 854
Timur Vafin Avatar asked Oct 24 '25 15:10

Timur Vafin


1 Answers

This can be configured in the .editorconfig file in your project. These settings use tabs on C# files, but spaces on csproj files:


[*.{cs}]
charset = utf-8-bom
indent_style = tab
tab_width = 4

[*.{csproj}]
charset = utf-8-bom
indent_style = space
indent_size = 2
tab_width = 2

like image 149
PMF Avatar answered Oct 26 '25 04:10

PMF



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!