This project is read-only.

Using with StyleCop

Sep 24, 2009 at 1:18 PM
Edited Sep 24, 2009 at 1:23 PM


I have been experimenting with the tool and I like it alot.

Usually I make use of tools like FxCop and StyleCop to enforce quality and consistency in the code base. I have not yet had WSCF generate code with FxCop errors (so long as you have the "Adjust casing" option selected). I do have issues with StyleCop though.

I'm not asking for to generate StyleCop compliant code (this would be difficult to achieve as StyleCop rules can be heavily customised). However, there is an option for StyleCop to skip generated files (identified by *.g.cs or *.generated.cs). As a work around for people like me, would it be possible to have include an option for generating the class files with a ".g.cs" suffix? This would result in StyleCop skipping generated files. At the moment I have to rename the files manually which is fiddly.

Many thanks,


Sep 25, 2009 at 8:33 AM

Hi Callum,

I will add this to the work item list. I have considered an option for making the code styleCop compliant, but as you say, that's hard to achieve and we would have to be able to support users who dont want StyleCop.. We are thinking of supporting T4 in a future version so it should be possible for someone to write a "default StyleCop" compliant template or their own customized styleCop compliant template and generate code into that.

Having said this, there are a couple of things you can try now,

(1) We found that StyleCop complains when it sees the header of a file which says "#region WSCF" and makes a number of complaints about the rest of the code as well . To get around this we add the tag "// <autogenerated/>" to the top of the file and this stops it from complaining.

(2) Possibly another option is to have a facility to hook into NArrange (which I only discovered yesterday actually) so that it auto formats the code. Apparently there is a stylecop setting for NArrange.



Sep 25, 2009 at 8:35 AM
This discussion has been copied to a work item. Click here to go to the work item and continue the discussion.
Dec 29, 2009 at 3:16 PM

You can control the name of the output file if you generated a single file instead of separate files. This would allow you to use the ".g.cs" suffix if you can live with generating a single file until we sort out this work item.