简体   繁体   English

在Resharper分析中忽略设计器和生成的文件

[英]Ignore designer and generated files in Resharper analysis

I've been using Resharper for a few days and I really like this tool, but there's one thing that annoys me about it and I wonder if it can be changed. 我一直在使用Resharper几天,我真的很喜欢这个工具,但有一件事让我烦恼,我想知道它是否可以改变。

I'm getting lots of issue notifications from generated code (almost 1400 in my project). 我从生成的代码中获得了很多问题通知(在我的项目中差不多有1400个)。 I'd want to set those files as ignored so they won't be checked as you can do with StyleCop and CodeAnalysis. 我想将这些文件设置为忽略,因此不会像使用StyleCop和CodeAnalysis那样检查它们。 Unfortunatelly it looks like Resharper ignores Generated Code settings from it's options because I'm still getting the same notifications. 不幸的是,看起来Resharper从它的选项中忽略了Generated Code设置,因为我仍然收到相同的通知。 I've tried setting a file mask (ie for *.resx ) and add files manually to generated, but still it doesn't change anything. 我已经尝试设置文件掩码(即*.resx )并手动添加文件生成,但它仍然没有改变任何东西。

I don't know if it matters but I'm using VS 2010. 我不知道它是否重要,但我正在使用VS 2010。

I've just received an answer for this from ReSharper support: 我刚从ReSharper的支持中得到了答案:

In order to skip those files during code inspection you should open ReSharper > Options > Code Inspection > Settings, press 'Edit items to skip' and add your files to that list. 要在代码检查期间跳过这些文件,您应该打开ReSharper>选项>代码检查>设置,按“编辑要跳过的项目”并将文件添加到该列表中。

I agree with RaYell's answer; 我同意RaYell的回答; to ignore those files completely, you'll need to add them to Items to Skip . 要完全忽略这些文件,您需要将它们添加到要跳过的项目中

Here is some more useful information: 这是一些更有用的信息:

What makes Generated Code different from Items to Skip ? 是什么让Generated Code要跳过的项目不同?

The entries on [the Generated Code page], which do allow masks (as well as regions), do get analyzed, yet no hints, warnings, suggestions or quick fixes are offered since it does not make much sense. [生成的代码页]上的条目(允许掩码(以及区域))确实得到了分析,但没有提供提示,警告,建议或快速修复,因为它没有多大意义。 However, and this is important , files still do get analyzed to provide error information and completion. 但是, 这很重要 ,文件仍然会被分析以提供错误信息和完成。 This is what makes Generated Code different from Items to Skip . 这就是使Generated Code要跳过的项目不同的原因。

http://blogs.jetbrains.com/dotnet/2011/06/preventing-items-from-being-analyzed-in-resharper/ http://blogs.jetbrains.com/dotnet/2011/06/preventing-items-from-being-analyzed-in-resharper/

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

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