Suppress Unused Member at Project Level
I have a Visual Studio solution that contains a number of c# projects. The solution makes us a common framework that we use for all our other development projects This framework encapsulates our service layer, data layer and common business objects.
For the projects that are nothing but a service layer, (almost) none of the methods are ever called from within the framework, so we get the ReSharper inspection flag on all our methods that "Method xxx is never used".
I know how to turn this off at the class level, but this is hundreds of classes. Is there a way to disable this inspection at the Project level? I wouldn't want to turn if off at the solution level since the inspection is worthwhile in my data layer projects that are called from the service layer.
Thanks for any guidance.
Please sign in to leave a comment.
Hello!
Thank you for contacting us.
Please refer to the following blog post describing how to turn on configuring severity per-project:
Thank you.
Angelina,
Thank you for your response. I was so excited when I read the article and I got everything set up with a project .DotSettings file. After getting that going, I was looking around for the actual UnusedMember setting to turn off. Well, from what I can tell, this is a setting at the "Global" level. And it seems that to turn this off, you have to uncheck Code Inspections -> Settings -> Show unused non-private type members when solution-wide analysis is off AND turn off solution-wide analysis!!!
So, am I thinking correctly that this just happens to be one of those settings that can't be set at the project level? I would not want to turn off solution-wide analysis. :)
Thanks!
Hello!
Thank you for the reply.
If we are talking about non-private accessibility of "Type or member is never used" inspection then those settings are required in case you need to enable the inspection. To disable the inspection there's no need to turn off solution-wide analysis.
I've just tried configuring dotsettings file per project so that "Type or member is never used" is disabled and solution-wide analysis is turned on and it works ok.
Thank you.
I've just tried configuring dotsettings file per project so that "Type or member is never used" is disabled and solution-wide analysis is turned on and it works ok.
How? I still can't figure out HOW to turn this off in a DotSettings file.
Toby Herring, did you ever figure this out? I'm in a similar situation where we create library-style projects to be used across other projects and it would be *very* beneficial to be able to disable a couple of these inspections globally for a solution, or at least for a project.
Thanks!