C#警告-使用NeutralResourcesLanguageAttribute标记程序集 [英] c# warning - Mark assemblies with NeutralResourcesLanguageAttribute

查看:163
本文介绍了C#警告-使用NeutralResourcesLanguageAttribute标记程序集的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我收到以下警告:

CA1824 用NeutralResourcesLanguageAttribute标记程序集

CA1824 Mark assemblies with NeutralResourcesLanguageAttribute

根据MSDN,其原因是:

According to MSDN, the cause of this is:

程序集包含基于ResX的资源,但没有对其应用System.Resources.NeutralResourcesLanguageAttribute.

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.

推荐答案

NeutralResourcesLanguageAttribute 通知资源管理器用于显示主程序集中包含的资源的语言.例如.如果您对程序集进行了编码,使其包含英语资源,则在AssemblyInfo.cs中添加以下行

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.

这篇关于C#警告-使用NeutralResourcesLanguageAttribute标记程序集的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆