如何添加自定义 FxCop 规则?
下面是我的自定义规则程序集和嵌入的 xml 资源文件。我的程序集名称和默认命名空间名称都是MyRules。我只是不明白为什么添加自定义 fxcop 规则会如此困难?我总是收到“未选择任何规则”错误。我要疯了...
using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.FxCop.Sdk;
namespace MyRules
{
public class MyRule1 : BaseIntrospectionRule
{
public MyRule1() :
base("MyRule1", "MyRules.TutorialRules",
typeof(MyRule1).Assembly)
{
}
}
}
<?xml version="1.0" encoding="utf-8"?>
<Rules FriendlyName="My Rules Friendly Name">
<Rule TypeName="MyRule1" Category="My Category" CheckId="SM0001">
<Name>My Name</Name>
<Description>My Desciription</Description>
<Url>http://www.google.com.in</Url>
<Resolution>My Resolution</Resolution>
<MessageLevel Certainty="95"></MessageLevel>
<Email></Email>
<FixCategories>NoBreaking</FixCategories>
<Owner>Bill</Owner>
</Rule>
</Rules>
Below are my custom rule assembly and embeded xml resources file. My assembly name and the default namespace name are both MyRules. I just cannot figure out why it could be SO SO difficult to add a custom fxcop rule? I always got the "no rules were selected" error. I am going crazy...
using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.FxCop.Sdk;
namespace MyRules
{
public class MyRule1 : BaseIntrospectionRule
{
public MyRule1() :
base("MyRule1", "MyRules.TutorialRules",
typeof(MyRule1).Assembly)
{
}
}
}
<?xml version="1.0" encoding="utf-8"?>
<Rules FriendlyName="My Rules Friendly Name">
<Rule TypeName="MyRule1" Category="My Category" CheckId="SM0001">
<Name>My Name</Name>
<Description>My Desciription</Description>
<Url>http://www.google.com.in</Url>
<Resolution>My Resolution</Resolution>
<MessageLevel Certainty="95"></MessageLevel>
<Email></Email>
<FixCategories>NoBreaking</FixCategories>
<Owner>Bill</Owner>
</Rule>
</Rules>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
问题解决了。
原来我错过了MessageLevel的内部文本。
Problem solved.
It turns out that I Miss the inner text of MessageLevel.