Resharper: I would like to enforce project naming convention
using Resharper I would ike to enforce project, namespace and assembly name convension. Here are the rules:
- My p开发者_运维问答roject is MyGreatString and the path is \MyUtilities\MyGreatString
- The name of the project and the assembly and the default namespace should be MyUtilities.MyGreatString
How can I do it by configuring Resharper?
Thanks, Tal
You need to specifiy the project's "root" namespace in the project settings Project | Properties | Application tab | Default namespace.
When MyUtilities.MyGreatString
is set up ReSharper will put a squiggly line under each namespace that does not match this prefix. The "Namespace does not correspond to file location" inspection can be changed to a severity of "Error" to have namespace errors appear in the "Errors in Solution" window (given that you have solution-wide analysis enabled).
You can also right-click on the project or solution and select Refactor | Adjust namespaces to correct all namespaces in one go.
Not sure if resharper can do that out of the box for you. You could possibly look at other options which can do static or synamic code analysis. One option is to write a custom rule using something like Stylecop and integrate that with Resharper. there is alsready a stylecop plugin for resharper. Possibly the combination of custome rules and stylecop custom rule should help you achieve you objective.
精彩评论