Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

c# warning - Mark assemblies with NeutralResourcesLanguageAttribute

Tags:

c#

warnings

fxcop

I'm getting the following warning:

CA1824 Mark assemblies with NeutralResourcesLanguageAttribute

According to MSDN, the cause of this is:

An assembly contains a ResX-based resource but does not have the System.Resources.NeutralResourcesLanguageAttribute applied to it.

Could anyone please explain what it means?
I don't want to define a specific cultural setting.
I want them to be customisable.

like image 575
user429400 Avatar asked Nov 01 '10 11:11

user429400


2 Answers

The NeutralResourcesLanguageAttribute informs the resource manager of the language that was used to display resources which are contained in the main assembly. E.g. if you coded your assembly so that it contains resources which are in English, then include the following line in your AssemblyInfo.cs

[assembly: NeutralResourcesLanguage("en")] 

This way, when looking up resources in English, the resource manager will not look for an English culture satellite assembly, but rather just use the resources contained in the main assembly. This is purely a performance optimisation.

like image 95
Adam Ralph Avatar answered Sep 19 '22 01:09

Adam Ralph


The NeutralResourcesLanguage attribute tells the resource manager about the language used in your neutral resources (the resources whose filename don't have a culture code suffix, e.g. YourModule.resx). That information can be used during the resource fallback process.

like image 35
Frédéric Hamidi Avatar answered Sep 21 '22 01:09

Frédéric Hamidi