How to point to a specific .editorconfig in a solution file?

Wendy Liang 0 Reputation points
2024-05-15T19:53:16.54+00:00

I see in the Roslyn open source project, Roslyn.sln points to the .editorconfig it wants to use. How does it work for me if I want to do the same: pointing to a specific .editorconfig in my solution file? https://github.com/dotnet/roslyn/blob/b6b06a61edecdfc9c054a6ea5be7d020226b7961/Roslyn.sln

C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
10,405 questions
{count} votes

1 answer

Sort by: Most helpful
  1. P a u l 10,406 Reputation points
    2024-05-15T20:37:23.67+00:00

    Do you mean how can you add a Solution-level .editorconfig? You can just save one next to your .sln file, then in Visual Studio right click on your Solution, click "Add > Existing Item..." & select your .editorconfig, then it should appear under the "Solution Items" virtual folder in VS & that'll apply to everything inside the Solution.

    If you want to generate an .editorconfig from your editor settings, you can go to "Tools > Options > Text Editor > C# > Code Style", then click the "Generate .editorconfig file from settings" button, then save it somewhere in your solution folder.