How to automate applying solutions that VS quick action offer to solve Stylecop(roslyn) code style errors

575 Views Asked by At

I'm introduce stylecop functionality with custom rule set in massive application that contain more than 100 projects. Roslyn compiler show errors and warnings in existing code and VS offers common fixes (quick actions). You press Ctrl+. and see fixes. It's so tedious and time-consuming operation select error, press shortcut and applying rule, when you have 100+ project.

I want to automatic apply the rules that in the list. Maybe some script that goes through error list, check that error id exist in list and apply that rule on project.

I hear about Visual Studio Extensions, can they help me? Can someone advise me how can I solve this problem?

1

There are 1 best solutions below

0
On

The Visual Studio Code Cleanup (find it in the Analyze menu) has a Code Cleanup option. You can configure a profile with the Fixers you want to run and the have it blast through a complete solution.

enter image description here

Save the profile with the fixers you want, then choose Run Code Cleanup (Profile) on Solution.