Friday, May 03, 2013

Mono.Options installation, and getting StyleCop to ignore a file

I've recently discovered the Mono.Options library (available via NuGet) that lets you easily parse arguments passed into a program. Unfortunately, the ease with which a package is typically installed via NuGet does not apply to Mono.Options because it's a single .cs file that gets included in your project, rather than a signed assembly. This becomes an annoyance in projects where StyleCop is used to enforce coding standards. Fortunately, there is a way to get StyleCop to ignore specific files (rather than forcing me to tweak my StyleCop settings for the project) which I found out about here. The TL;DR for that article: edit your project file, and underneath the element for the offending file, insert a <ExcludeFromStyleCop>true</ExcludeFromStyleCop> element.

No comments: