Visual studio 2017 not indenting code properly

2.2k views Asked by At

I've just installed Visual Studio 2017 and began writing my ASP.NET MVC 5 web app. I've come across this issue where the indentation of code is not correct. What I noticed is that when I hit the semicolon on var priv = new Phonebase(); it will shift out of the scope that it belongs to.

I've played around with indentation settings for C#, but I couldn't remedy the issue. I've tried smart indentation and block indentation. Does anyone know how I can get Visual Studio to ident lines of code properly?

Incorrect indentation

1

There are 1 answers

0
Josh On

I found a .editorconfig file in the root of my c drive (c:\.editorconfig). When I deleted this file, this issue went away for me.

See this page for more information and fixes with .editorconfig