首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Fxcop GUI中未显示Fxcop自定义规则

Fxcop GUI中未显示Fxcop自定义规则
EN

Stack Overflow用户
提问于 2012-10-17 19:38:12
回答 1查看 472关注 0票数 1

我已经创建了一个Fxcop自定义规则并定义了xml文件。当我在Fxcop GUI中添加自定义规则程序集时,它没有显示该规则。请查看以下相关信息:

代码语言:javascript
复制
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.FxCop.Sdk;

namespace TestCustomRules
{
    public class TestRule : BaseIntrospectionRule
    {
        public TestRule() : base("TestRule", "TestCustomRules.TestRules", typeof(TestRule).Assembly) { }

        public override ProblemCollection Check(Member member)
        {
            Problems.Add(new Problem(new Resolution("TEST Rule {0}", "Chill out")));
            return Problems;
        }
    }
}

xml文件:

代码语言:javascript
复制
<?xml version="1.0" encoding="utf-8" ?>
<Rules FriendlyName="Test Rules">
  <Rule TypeName="TestRule" Category="TestRule" CheckId="TR1000">
    <Name>Test Rule</Name>
    <Description>Test Rule</Description>
    <Owner>Vibgy Joseph</Owner>
    <Url />
    <Resolution>This is just a test rule.</Resolution>
    <Email />
    <MessageLevel Certainty="99"> Warning</MessageLevel>
    <FixCategories> Breaking </FixCategories>
  </Rule>
</Rules>

下面是我添加Fxcop时在Fxcop中显示的信息。请注意,子对象总数为0。

代码语言:javascript
复制
FxCop Rule Assembly c:\users\vibgy.j\documents\projects\01_common\testcustomrules\testcustomrules\bin\debug\testcustomrules.dll
{
    Checked              : True   (Boolean)
    Children             : Count == 1  (NodeBaseDictionaryCollection)
    Container            : Count == 10  (NodeBaseDictionary)
    DefaultCheckState    : True   (Boolean)
    DisplayName          : TestCustomRules.dll  (String)
    FileIdentifier       : C:\Users\vibgy.j\Documents\Projects\01_Common\TestCustomRules\TestCustomRules\bin\Debug\TestCustomRules.dll  (String)
    FileName             : C:\Users\vibgy.j\Documents\Projects\01_Common\TestCustomRules\TestCustomRules\bin\Debug\TestCustomRules.dll  (String)
    FullyQualifiedName   : C:\Users\vibgy.j\Documents\Projects\01_Common\TestCustomRules\TestCustomRules\bin\Debug\TestCustomRules.dll  (String)
    HasChildren          : True   (Boolean)
    HasMessages          : True   (Boolean)
    ImageIndex           : 1  (Int32)
    LoadExceptions       : Microsoft.FxCop.Common.ExceptionCollection  (ExceptionCollection)
    LocalFileName        : TestCustomRules.dll  (String)
    Messages             : Count == 0  (MessageStatusNodeBaseMessageDictionary)
    Metadata             : <null>  (Object)
    Name                 : c:\users\vibgy.j\documents\projects\01_common\testcustomrules\testcustomrules\bin\debug\testcustomrules.dll  (String)
    Rules                : Count == 0  (RuleDictionary)
    Status               : New  (NodeStatus)
    TotalChildren        : 0  (Int32)
    TotalChildrenChecked : 0  (Int32)
    Version              : 1.0.0.0  (String)
}
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2012-10-17 19:42:39

糟了!我没有将xml文件的属性“Build Action”设置为“Embedded Resource”。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/12933439

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档