Using Visual Studio Community 2022, version 17.4.4.
I just created a WPF (.NET Framework) solution using the built in VS template. To this solution, I wanted to add a .editorconfig
file to aid with code formatting. However, when right clicking the solution in Solution Explorer and following Add -> New Item... -> editorconfig File (.NET)
and naming it .editorconfig
, Visual Studio simply does not create it.
I followed these same steps again, but instead selected to add a plain .txt
file and it seemed quite happy creating it.
It's worth noting that I can add a new .editorconfig
to projects within the solution, but as I plan to add more projects in the future, I would like the solution itself to contain a top level .editorconfig
rather than need to duplicate it per project.
I have tried restarting VS, updating it, repairing it, and creating a completely separate solution. I get the same results. I'm aware .editorconfig
files are just plaintext files themselves, and that I can create a blank file and type into it manually, but ideally I want all of the presets to be populated out of the box.
Any help would be appreciated.
EDIT: I managed to temporarily get around it by creating it from VS settings: Tools -> Options -> Text Editor -> C# -> Code Style
and selecting the Generate .editorconfig file from settings
option. From here I select the solution folder. This doesn't solve the original issue that the add
context menu option doesn't create it, however.