Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

.editorconfig not doing anything in VS2017?

I have the following version of visual studio:

Microsoft Visual Studio Community 2017 Version 15.1 (26403.7) Release VisualStudio.15.Release/15.1.0+26403.7

I created a new project and added a .editorconfig file at my solution base folder. It's content is the following:

root = true

[*.cs]
indent_style = space:warning
indent_size = 12:warning

# CSharp and VisualBasic code style settings:
[{*.cs,*.vb}]
dotnet_style_qualification_for_field = false:warning

The file location should be right:

.editorconfig <-- Here it is
ApplicationInsights.config
App_Data
App_Start
bin
Content
Controllers
favicon.ico
fonts
Global.asax
Global.asax.cs
Models
obj
packages.config
Properties
Scripts
Startup.cs
Views
Web.config
Web.config.backup.1
Web.Debug.config
Web.Release.config
WebApplication8.csproj
WebApplication8.csproj.user

But whenever I edit a .cs file, nothing special happen (despite indentation not follwing the rule), I excpect warning (after a build for instance) to show up, but no.

Is there something wrong with my configuration, or is there something which could hinder the configuration from being applied?

like image 657
Serge Intern Avatar asked Apr 25 '17 13:04

Serge Intern


1 Answers

I had this same problem. The solution was adding the .editorconfig to the Solution in my case. You can choose to either add it to the Solution or the Project depending on whether you want it applied everywhere or just the individual Project.

Solution Explorer -> Right-click your Solution/Project -> Add -> Existing Item... (if you have the .editorconfig file in position at the root of the Solution/Project) or New Item... (then search for editorconfig in the Add New Item wizard and choose the appropriate type for your work)

like image 87
thesupersoup Avatar answered Sep 28 '22 10:09

thesupersoup