C# 安装自定义StyleCop规则

C# 安装自定义StyleCop规则,c#,stylecop,C#,Stylecop,在开始创建自定义StyleCop规则时,我遵循了上的说明 •我创建了一个类,MyStyleCopRules.cs: [SourceAnalyzer(typeof(CsParser))] public class MyStyleCopRules : SourceAnalyzer { public override void AnalyzeDocument(CodeDocument document) { ... •添加了一个XML文档,其构建操作设置为Embedde

在开始创建自定义StyleCop规则时,我遵循了上的说明

•我创建了一个类,
MyStyleCopRules.cs

[SourceAnalyzer(typeof(CsParser))]
public class MyStyleCopRules : SourceAnalyzer
{
    public override void AnalyzeDocument(CodeDocument document)
    {
       ...
•添加了一个XML文档,其构建操作设置为EmbeddedResource,名为
MyStyleCopRules.XML

<?xml version="1.0" encoding="utf-8" ?>
<SourceAnalyzer Name="My StyleCop Rules">
    <Rules>
      <Rule Name="Fully Qualified Using Statements" CheckId="IS0001">
        <Context>Using statements must be fully qualifed.</Context>
        <Description>Fires when using statements are not fully qualifed.</Description>
      </Rule>
    </Rules>
</SourceAnalyzer>

使用语句必须是完全限定的。
使用不完全限定的语句时激发。
其他可能相关的事实:

  • 这个库正在framework3.5版本中构建

  • 我已经在StyleCop所在的目录中删除了这个库的发布版本

  • 我使用
    StyleCop.MSBuild
    (版本4.7.50)进行StyleCop集成,因此我将它复制到
    \packages\StyleCop.MSBuild.{version}\tools

  • 库中引用的StyleCop版本与我复制它旁边的版本相同。(我已经使用ILSpy检查了版本。)

  • 我使用的是Visual Studio 2015,但我没有使用分析器


当我打开
Settings.StyleCop
文件时,我看不到规则,也看不到它们在
visualstudio
中运行的任何迹象



我遗漏了什么?

完全限定使用语句的
中不需要空格

即:

<?xml version="1.0" encoding="utf-8" ?>
<SourceAnalyzer Name="My StyleCop Rules">
    <Rules>
      <Rule Name="FullyQualifiedUsingStatements" CheckId="IS0001">
        <Context>Using statements must be fully qualifed.</Context>
        <Description>Fires when using statements are not fully qualifed.</Description>
      </Rule>
    </Rules>
</SourceAnalyzer>

使用语句必须是完全限定的。
使用不完全限定的语句时激发。

我面临的问题是我的SO帖子。你能帮助我吗?