繁体   English   中英

用fxcop看不到我的自定义规则

[英]Can't see my custom rules with fxcop

我正在尝试为fxcop开发自定义规则。

我有这个代码:

namespace TestCustomRuleFxCop
{
    public class DoTheRightThingRule : BaseIntrospectionRule
    {
        public DoTheRightThingRule()
            : base("DoTheRightThing", "TestCustomRuleFxCop.Rules", 
                    typeof(DoTheRightThingRule).Assembly)
        {
        }

        public override ProblemCollection Check(Member member)
        {
            return null; // todo
        }
    }
}

我有这个xml(名为Rules.xml,并将构建操作设置为嵌入式资源)

<?xml version="1.0" encoding="utf-8" ?>
<Rules FriendlyName="My rules">
  <Rule TypeName="DoTheRightThingRule" Category="MyCategory" CheckId="MyId">
    <Name>My rule name</Name>
    <Description>My description</Description>
    <Resolution>Add Resolution</Resolution>
    <Email></Email>
    <MessageLevel Certainty="100">Warning</MessageLevel>
    <FixCategories>Breaking</FixCategories>
  </Rule>
</Rules>

我编译,运行fxcop并使用此dll添加规则。

我可以看到“我的规则”文件夹,但是其中没有规则...

我想念什么?

谢谢您的帮助,最诚挚的问候

有关导致缺少规则的一些最常见问题,请参见http://msmvps.com/blogs/calinoiu/archive/2007/04/21/no-rules-in-your-fxcop-rule-assembly.aspx 根据您提供的详细信息,我猜测问题可能出在您的资源名称上,还是(如果您粘贴了确切的代码)是因为您传递给基本构造函数的规则名称与您的规则名称不匹配。规则类型名称(“ DoTheRightThing”与“ DoTheRightThingRule”)。

暂无
暂无

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

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