Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Disable Resharper's "Adjust namespace" for specific files

I have a class with a namespace not matching the folder structure of the project.

With // ReSharper disable once CheckNamespace I can disable the hint that the namespace does not correspond to the file-location. But when Refactoring the Projects namespaces, the class is still selected for adjusting the namespace.

Is there a way to disable the adjust namespace?


Update with sample:

In my case I have a view class that has to be in the System.Web.Mvc-Namespace. The file location is [Root]>src>Views The default namespace of the Root-Project is Com.xxxxx.Commons.Web

So Resharper always wants to adjust the namespace to either Com.xxxxx.Commons.Web.Views or to Com.xxxxx.Commons.Web if I disable the namespace-provider-flag für the Views folder.

like image 533
Tobias Avatar asked Feb 09 '23 18:02

Tobias


1 Answers

Unfortunately it's a long existing bug in R# that disable CheckNamespace isn't respected by the "Adjust namespaces" refactoring. As I know, there is no other way to exclude specific files from this refactoring.

like image 88
ulrichb Avatar answered Feb 14 '23 10:02

ulrichb