C
C#3w ago
elemas

✅ Share VS settings to my team through git

Hey, is there any way to share some settings of Visual Studio through git with my team? I couldn't find any option for this in VS 2022, and VS 2026 (insider) has the "edit user settings as json" option, but it references a file in the local install directory of VS. The goal is to set code standards and harmonize how it looks as much as possible. I'm looking for settings like the list of rules to run when using Code Cleanup, and whether to run Code Cleanup when saving a file. We already have a .editorconfig file in the repo with a bunch of rules set (but none that are blocking builds).
5 Replies
kurumi
kurumi3w ago
If you want to enforce consistent code standards, it's best to set up analyzers. There's already a great solution based on Roslyn - check out these links: https://anthonysimmon.com/workleap-dotnet-coding-standards/ https://www.meziantou.net/sharing-coding-style-and-roslyn-analyzers-across-projects.htm https://github.com/workleap/wl-dotnet-codingstandards Visual Studio also has an option to export your settings, so you can share your code cleanup profiles with the team I'm not sure if it's possible to share these settings seamlessly through git since they're tied to Visual Studio rather than the solution. But you can share them as artifacts if needed - just keep in mind that each machine will have to be set up manually
No description
kurumi
kurumi3w ago
Another great thing you can do - setup git hooks. So, whenever you try to commit some changes, git hooks it and runs dotnet format for your repo $close
MODiX
MODiX3w ago
If you have no further questions, please use /close to mark the forum thread as answered
elemas
elemasOP3w ago
Very good read, thanks a lot
viceroypenguin
for code standards, you will wnt to use an .editorconfig. read https://learn.microsoft.com/en-us/dotnet/fundamentals/code-analysis/code-style-rule-options for how to set various configuration values. using editorcnfig means you don't need to import/export VS settings, as VS will read these and override VS in the context of that codebase.

Did you find this page helpful?