# Friday, 22 October 2010

At my current client I was tasked with implementing coding standards and styles and developing a process so the configurations can be easily maintained and shared.  ReSharper was already in place at the client and the since 99% of what they wanted to enforce, initially at least, was style related I chose to combine ReSharper with StyleCop.

After looking around the interwebs for awhile I realized this process is either impossible or undocumented…or both.

The process I came up with is about 90% of what I was hoping and still requires two manual steps by the developer but overall it is solid.  So, let’s get started.  First download and install the following tools:

  1. StyleCop 
  2. StyleCop+

Although StyleCop+ is technically not required it does a great job with allowing you to extend and customize a lot of the built in StyleCop rules.  So I certainly recommend it.

The trick with StyleCop is that it will continue to look up the code tree for settings files and keep adding them together and then adds the settings file from StyleCop install directory to top things off.  That is unless you tell it to do otherwise.  What where going to do is first place a Settings.StyleCop file where all devlopers can access it.  Next we are going to place another at the root of our code directory.  So if your code resides at C:\Dev\Code then place the Settings.StyleCop file there.  We can then open up the settings file we placed out on the network that everyone has access to and tell it not to merge with any other settings file.  This will be the official settings file.


Next we will open the settings file in the root of our source tree and tell it merge only with the settings in the shared location.


Now once you make changes at the shared level they will be merged with each developers settings file.

Next we can deal with ReSharper…Stay Tuned!

posted on Friday, 22 October 2010 16:19:52 (Central Daylight Time, UTC-05:00)  #    Comments [9]