2014-04-18 30 views
4

我試圖使用visual studio的代碼分析功能。不幸的是(或者幸運的是),我住在加拿大,代碼分析抱怨拼寫單詞「color」。我試圖使用custom dictionary,但VS2013似乎忽略了它。VS2013代碼分析自定義字典不工作

這裏的字典相對於項目(和解決方案)的位置:

enter image description here

這裏的字典文件的內容:

<Dictionary> 
    <Words> 
    <Unrecognized> 
     <Word></Word> 
    </Unrecognized> 
    <Recognized> 
     <Word>colour</Word> 
    </Recognized> 
    <Deprecated> 
     <Term PreferredAlternate=""></Term> 
    </Deprecated> 
    <Compound> 
     <Term CompoundAlternate=""></Term> 
    </Compound> 
    <DiscreteExceptions> 
     <Term></Term> 
    </DiscreteExceptions> 
    </Words> 
    <Acronyms> 
    <CasingExceptions> 
     <Acronym></Acronym> 
    </CasingExceptions> 
    </Acronyms> 
</Dictionary> 

我也試着剔除下來自定義字典的內容爲:

<Dictionary> 
    <Words> 
    <Recognized> 
     <Word>colour</Word> 
    </Recognized> 
    </Words> 
</Dictionary> 

有誰知道發生了什麼事以及我如何解決這個問題?

+2

異端,雖然它可能看起來,我不情願地接受了當涉及到編程,(美國)美式英語是生活中的事實。如果您將區域性詞語引入到絕對以美國拼寫爲導向的系統中,您將會引入噪音和模糊性。當我在程序中看到「顏色」一詞時,我就會詛咒。我變成什麼了? – spender

+0

我們想要感謝你們所有的人都會用我們的語言。 – paqogomez

回答

6

您不需要爲此使用自定義字典。相反,如果您在代碼庫中一直使用加拿大拼寫,則可以使用CodeAnalysisCulture MSBuild property指定使用en-CA作爲拼寫規則應運行的語言。 例如

<CodeAnalysisCulture>en-CA</CodeAnalysisCulture> 
+1

這確實解決了我的問題,但沒有回答我的問題。你會不會知道自定義字典中發生了什麼? –

+8

您是否將自定義詞典文件的構建操作設置爲「CodeAnalysisDictionary」(按照http://msdn.microsoft.com/en-us/library/bb514188.aspx#BKMK_ToApplyACustomDictionaryToAProject)? –