C# Can';我看不到fxcop的自定义规则
我正在尝试为fxcop开发一个自定义规则 我有以下代码:C# Can';我看不到fxcop的自定义规则,c#,fxcop,C#,Fxcop,我正在尝试为fxcop开发一个自定义规则 我有以下代码: namespace TestCustomRuleFxCop { public class DoTheRightThingRule : BaseIntrospectionRule { public DoTheRightThingRule() : base("DoTheRightThing", "TestCustomRuleFxCop.Rules",
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并将构建操作设置为embedded ressource)
我的规则名
我的描述
添加分辨率
警告
打破
我用这个dll编译、运行fxcop并添加规则
我可以看到“我的规则”文件夹,但其中没有规则
我错过了什么
谢谢你的帮助,
致意有关导致规则缺失的一些最常见问题,请参阅。根据您提供的详细信息,我猜想问题要么在于您的资源名称,要么在于(如果您粘贴了确切的代码)传递给基本构造函数的规则名称与您的规则类型名称不匹配(“DotherLightThing”vs“DotherLightThingRule”).有关导致规则缺失的一些最常见问题,请参阅。从您提供的详细信息来看,我猜问题在于您的资源名称,或者(如果您粘贴了确切的代码)您传递给基本构造函数的规则名称与您的规则类型名称不匹配(“DotherLightThing”vs“DotherLightThingRule”)。感谢您的帮助,在重新创建项目之后,它正在工作。。。感谢您的帮助,在重新创建项目后,它正在工作。。。顺致敬意,
<?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>