7

I'm interested in creating custom rules for Code Analysis (Visual Studio 2010 and above) which target the XAML specifically.

I've read about creating custom rules and even about FXCop + XAML Toolkit, but the later is now archived and doesn't support latest versions of FXCop (i.e. the version that Code Analysis works with). I've also looked at other tools such as NDepend but it doesn't seem to support this either.

An example for a custom rule I'd like to make: Make sure no elements in the XAML have the Width property set to a constant.

Any ideas on how to do this in VS 2012/VS 2013 (any external tool that integrates with Visual studio is also an option)?

4

2 回答 2

0

我们的代码分析产品http://submain.com/CodeIt.Right包含一组开箱即用的 XAML/SL/WPF 规则,您还可以使用 CodeIt.Right 自定义规则 SDK 创建您提到的自定义规则。我们很乐意引导您完成您的自定义规则。

谢谢!

于 2012-10-19T06:00:30.920 回答
0

StyleCop 规则可能是您所追求的,而不是 CodeAnalysis 规则。CodeAnalysis 对编译后的代码起作用,这使得验证 xaml 代码变得更加困难。

StyleCop 在源代码上工作,允许您使用像 XPath 这样简单的东西来制作检查,以验证属性或值的存在。

于 2014-09-07T13:17:52.963 回答