how to run StyleCop rules automatically during IDE build

Mar 9, 2012 at 2:09 PM

 

All --

Please help.

How can one run all StyleCop rules automatically when a build is done in the Visual Studio 2010 IDE.

 

Here are the details.

Our team's current setup for each workstation is the following...

- Install the latest MSI, (currently "StyleCop-4.7.11.0.msi").

- Open the project in Visual Studio.

- Checkout the project file in Visual Studio.

- Right-click on the project in the Solution Explorer, then choose "StyleCop Settings".

- Choose the tab "Settings Files".

- The radio-button "Merge with the following settings file" should be selected; so, if it is not selected, then select it.

- The item "Location" should point the shared settings file as follows...

C:\Code\SharedTools\StyleCop\Settings\Settings.StyleCop

- Save the project.

- Done.

 

With that being done...

...in Case A, when we choose >Tools, >Run StyleCop, then all the StyleCop rules do fire...

...BUT...

...in Case B, when we choose >Build, >Rebuild Solution, all the StyleCop rules do not fire...

 

So the question is how can one cause all the StyleCop rules to run when choosing >Build, >Rebuild Solution?

Please advise.

Thanks.

-- Mark Kamoski

Mar 9, 2012 at 2:13 PM

 

All --

Please excuse my question above.

I found the answer here...

http://stylecop.codeplex.com/wikipage?title=Setting%20Up%20StyleCop%20MSBuild%20Integration&referringTitle=Documentation

...and apparently what I was looking for was "StyleCop build integration" but missed that key phrase, etc.

Thanks.

-- Mark Kamoski