Verwenden eines Wörterbuches für die Codeanalyse (Code Analysis Dictionary)

Um der Codeanalyse Eigennamen beizubringen, kann man dem Projekt eine “Dictionary” hinzufügen.

Warning    6    CA1704 : Microsoft.Naming : Correct the spelling of ‘Alegri’ in assembly name ‘Alegri.SharePoint.FarmSolution1.dll’.    Alegri.SharePoint.FarmSolution1

Warning    6    CA1709 : Microsoft.Naming : Correct the casing of ‘MPP’ in namespace name ‘Alegri.SharePoint.FarmSolution1.eMPP’ by changing it to ‘Mpp’.    Alegri.SharePoint.FarmSolution1

Einfach eine XML Datei mit dem Namen CustomDictionary.xml dem Projekt hinzufügen.

<?xml version="1.0" encoding="utf-8" ?>
<Dictionary>
<Words>
<Unrecognized>
<Word></Word>
</Unrecognized>
<Recognized>
<Word>Alegri</Word>
</Recognized>
<Deprecated>
<Term PreferredAlternate=""></Term>
</Deprecated>
<Compound>
<Term CompoundAlternate=""></Term>
</Compound>
<DiscreteExceptions>
<Term></Term>
</DiscreteExceptions>
</Words>
<Acronyms>
<CasingExceptions>
<Acronym>MPP</Acronym>
</CasingExceptions>
</Acronyms>
</Dictionary>

Danach die Buildaction für die Datei auf “CodeAnalysisDictionary” stellen und die Warnungen sind weg.


Eine ausführliche Beschreibung findet ihr auf msdn.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s