Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to share Visual Studio 2022 Code Cleanup settings with team

Hi I am using Visual Studio 2022. I want to share code cleanup on save setting with my team. How can i do it? I tried to export settings and import it but without success.

like image 618
really Avatar asked Jan 29 '26 10:01

really


2 Answers

Not possible at the moment, 2023-09-19, but there is a ticket for it at Developer Community:

https://developercommunity.visualstudio.com/t/Provide-a-way-to-share-Code-Cleanup-prof/824754

You can however achieve quite a good result with these settings:

Since Visual Studio 17.3 you can set these values in Configure Code Cleanup:

Fix analyzer warnings and errors set in EditorConfig
Fix all warnings and errors set in EditorConfig 

enter image description here

Then make sure to set Tools -> Options -> Text Editor -> Code Cleanup -> "Run Code Cleanup profile on Save"

enter image description here

https://devblogs.microsoft.com/visualstudio/bringing-code-cleanup-on-save-to-visual-studio-2022-17-1-preview-2/

If every team member has these settings then it comes pretty close to shared Code Cleanup settings.

like image 131
Ogglas Avatar answered Feb 01 '26 21:02

Ogglas


Menu: Tools -> Options
Open tree to: Text Editor -> C# -> Code Style -> General

Use the Generate .editorconfig file from Settings button.

enter image description here Check that in to the root of your code repo.

like image 31
ctacke Avatar answered Feb 01 '26 19:02

ctacke



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!