using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xaml.Tools.XamlDom;
using System.Xaml;
using Microsoft.FxCop.Sdk;
namespace Microsoft.Xaml.Tools.FxCop.Rules
{
public class PropertiesCanOnlyBeSetOnce : BaseXamlRule
{
public PropertiesCanOnlyBeSetOnce() : base("PropertiesCanOnlyBeSetOnce") { }
public override void CheckXaml(XamlDomObject rootObjectNode, System.Xaml.XamlSchemaContext schemaContext, string resourceName)
{
foreach (XamlDomObject objectNode in rootObjectNode.DescendantsAndSelf())
{
List
foreach (XamlDomMember memberNode in objectNode.MemberNodes)
{
if (!membersSet.Contains(memberNode.Member))
{
membersSet.Add(memberNode.Member);
}
else
{
Problems.Add(CreateProblem(GetResolution(memberNode.Member.Name), memberNode.Member.Name, memberNode, resourceName));
}
}
}
}
}
}
Now I am able to add XAML Toolkit Rules in FxCop 1.36 and even able to run the silverlight Application against it. But After running the application Not getting any error.
In case I want to write my own custom rules for XMAL what steps I have to follow. Could I get any sample code snippets.
Already I had added following code
public abstract class BaseXamlRule : BaseIntrospectionRule
{
public abstract void CheckXaml(XamlDomObject rootObjectNode,
XamlSchemaContext schemaContext,
string resourceName)
{
}
}
for XamlSchemaContext added System.XMAL Namespace but still I am not able to get XamlDomObject Class. What namespace I have to add for it ?
Please Provide sample code snippets writing XMAL rules.
Thanks,
Parixit Pandey
Thanks!
]]>http://social.msdn.microsoft.com/Forums/en-US/wpf/thread/ef97f8a1-2773-46a3-8133-d895c4486b12
]]>In my Machine I had Installed VS2010 Ultimate edition. even I had Installed FxCop 1.36 and Downloaded XAML Toolkit Rules. in Fxcop FxCop.exe.config file changed VS2010 Version But when I am trying to add rules in Fxcorp it giving error rules are not valid.
]]>