My custom rule doesn´t appear in StyleCopSettingsEditor

Nov 9, 2010 at 9:06 AM

Hello,

I have created a custom rule using stylecop sdk. I have put the custom rule in the StyleCop directory (C:\Program Files (x86)\Microsoft StyleCop 4.4.0.14). I can see the rule using Visual Studio, I right click on the project and there is my custom rule. I can enable this rule and it shows me the warnings ok, but there is a couple of issues.

First of all, when I try to open the settings using StyleCopSettingsEditor without Visual Studio the rule doesn´t appear. I have tried to open the stylecop settings associated with the project and the settings file which is located in the installation folder and my rule doesn´t appear.

And there is another issue when I edit the settings inside VisualStudio using the StyleCopSettingsEditor. When I look directly the stylecop settings file only shows my custom rule when is disabled:

<Analyzer AnalyzerId="StyleCopCustomRule.MyCustomRule">

<Rules> <Rule Name="CodeMustNotContainHardCodedStrings">

<RuleSettings> <BooleanProperty Name="Enabled">False</BooleanProperty> </RuleSettings>

</Rule> </Rules> </AnalyzerSettings></Analyzer>

However if my rule is set the above code disappear, but the rule works fine. How is that possible? I thought it only would change the booleanproperty to true.

Any ideas?

 

 

Developer
Nov 21, 2010 at 7:43 AM
almarma4 wrote:
However if my rule is set the above code disappear, but the rule works fine. How is that possible? I thought it only would change the booleanproperty to true.

Why did you think that? You have just returned the rule to its defaut state - "enabled", so it's not needed to mention it in config anymore.

Best regards,
Oleg Shuruev