Some points for using StyleCop in general:
- You don't need to have StyleCop installed on your (or the build) machine - simply add StyleCop's binaries to your source control (about 1.5 MB of stuff)
Then simply add the relative reference to your project files, like this (I left out < and >):
Import Project="....libMicrosoft StyleCopMicrosoft.StyleCop.Targets"
We treat all StyleCop warnings as errors using the StyleCopTreatErrorsAsWarnings
setting in the project file.
- For legacy projects, you can use the tool provided by Microsoft to automatically set all existing source files to ignore.
- You can put the StyleCop settings file (
Settings.StyleCop
) in the root directory where your VS solution is (and of course place it under the source control). StyleCop knows how to find this file automatically (by loooking up the directory tree). This way you can have custom settings for each solution.
- We turned off certain StyleCop rules which we think aren't very practical to follow.
This way StyleCop will be integrated in your compile step and as such it will become a part of the CI build.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…