5

editorconfig file in my projects which works fine on VSCODE but the same doesnt work in the VISUAL STUDIO 2017 version : 15.5.4. As per the Documentation on GITHUB Repo https://github.com/editorconfig/editorconfig-visualstudio#readme it should work but it doesnt. Has anybody tried it with Visual Studio. My .editorconfig file :

root = true
[*]
indent_style = space
indent_size = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
Imran
  • 71
  • 1
  • 8

3 Answers3

3

Make sure that the editorconfig file is at the root folder of your repository and not just in the same folder as your solution file.

I had a similar issue in VS 2017 15.9 : I had added the editorconfig file to my solution, following Microsoft's documentation, but it didn't get applied. My solution had a weird architecture : the solution file was not in the root folder of my repository, but in its own subfolder. The editorconfig file was created in this subfolder. Here's the interesting bit in the documentation :

When you add an .editorconfig file to a folder in your file hierarchy, its settings apply to all applicable files at that level and below.

So what's important is the actual filesystem hierarchy, not your solution's hierarchy. I moved the editorconfig file to the actual root folder of my project, it worked instantly.

Ogier
  • 150
  • 9
0

In my experience, using [*] as a rule seems to be faulty. Try specifying some actual extensions as a work-around? Hopefully this gets resolved.

Hendrik
  • 1,981
  • 16
  • 11
0

Does your solution have a parent folder named between square brackets [] like this [ParentFolderName]?

If so maybe that's the reason why .editorconfig file does not work.

Check this link

yahiheb
  • 147
  • 9