简体   繁体   English

撤消“文件夹” <folderName> 来自Resharper的“不引入命名空间”

[英]Undo “Folder '<folderName>' do not introduce namespace” from Resharper

I created a class within a sub-folder of my project, and the namespace didn't match the folder structure. 我在项目的子文件夹中创建了一个类,并且命名空间与文件夹结构不匹配。 Resharper underlined the namespace and, while looking at the options Resharper presented to fix the problem, accidentally selected the option for "Folder does not generate a namespace". Resharper强调了命名空间,并且在查看Resharper为解决问题而提出的选项时,意外地选择了“Folder not not a namespace”选项。 Where is that setting stored? 该设置存储在哪里? I want to undo that choice so that Resharper enforces namespace / directory parity, at least for that folder. 我想撤消该选择,以便Resharper强制执行命名空间/目录奇偶校验,至少对于该文件夹。

I've checked in the .sln and then .csproj file, along with the directory in question for any loose files that might contain the information, and can't find how Resharper is storing that in order to remove it. 我已经检查了.sln然后.csproj文件,以及有问题的目录,查找可能包含该信息的任何松散文件,并且无法找到Resharper如何存储它以便将其删除。

在此输入图像描述

Thanks to DavidG for the technical answer, but I just stumbled on what could be considered the "correct" way to change the setting, at least it is friendlier than manually editing a raw XAML file. 感谢DavidG的技术答案,但我只是偶然发现可以被认为是改变设置的“正确”方式,至少它比手动编辑原始XAML文件更友好。

If you select the folder in the Solution Explorer and check the properties window, there is a property called "Namespace Provider" under a "ReSharper" catagory. 如果在解决方案资源管理器中选择该文件夹并检查属性窗口,则在“ReSharper”类别下会有一个名为“Namespace Provider”的属性。 Setting it to true will restore the default behavior of ReSharper expecting the namspace to match the directory structure. 将其设置为true将恢复ReSharper的默认行为,期望namspace与目录结构匹配。

属性窗口

You should have a file next to your project file called projectname.csproj.Dotsettings . 您应该在项目文件旁边有一个名为projectname.csproj.Dotsettings文件。 You will find the settings in there. 你会在那里找到设置。 If that's the only project specific setting, just delete the file. 如果这是唯一的项目特定设置,只需删除该文件。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM