Disable Resharper "Configure Namespace" for specific files

I have a class with a namespace that doesn't match the project folder structure.

With // ReSharper disable once CheckNamespace

I can turn off the hint that the namespace does not match the file location. But when redesigning project namespaces, the class is still selected to customize the namespace.

Is there a way to disable changing the namespace?


Update with example:

In my case, I have a view class that needs to be in System.Web.Mvc

-Namespace. File location: [Root]> src> Views Default namespace of root projectCom.xxxxx.Commons.Web

So Resharper always wants to set the namespace to Com.xxxxx.Commons.Web.Views

or Com.xxxxx.Commons.Web

if I turn off the namespace-provider flag for the Views folder.

+3


source to share


3 answers


Unfortunately, this is a long existing bug in R # that the disable CheckNamespace

Configure Namespaces refactoring does not honor. As I know, there is no other way to exclude certain files from this refactoring.



+4


source


You can disable the folder as a namespace provider by opening the properties window (right click -> properties) for the folder you want to exclude and change the namespace provider to false.



+2


source


The ReSharper Adjust Lames refactoring no longer affects the tagged namespaces // ReSharper disable CheckNamespace

. A long-standing bug in ReSharper (as referenced in @ulrichb's old answer) has been fixed as of ReSharper 2016.2.

Note that currently (ReSharper 2018.1) there is still an error in the UI where all files are still displayed in the Customize Namespace Name UI, but namespace changes do not actually take place. This is misleading, but ReSharper did fix the problem.

0


source







All Articles