c# - 文件详细信息选项卡中的 "Language neutral"属性

标签 c# dll localization assemblies

如何更改用 C# 编写的 DLL 的语言属性?

我尝试进入 Project Properties -> Assembly Information -> Neutral Language ComboBox 并将其设置为 English (United States)

在我构建/重建项目/解决方案后,当我右键单击 DLL 并转到“详细信息”选项卡时,“语言”属性始终显示语言中性。

编辑: 我找到的解决方案是使用外部 *.res 文件(简单地由 Visual Studio 生成),然后在对话框 Project Propertie->Application Tab-> Resource File

中选择它

最佳答案

此属性设置 AssemblyInfo.cs 文件中的 [AssemblyCulture] 属性。 MSDN 库文章的备注部分有这条重要说明:

The attribute is used by compilers to distinguish between a main assembly and a satellite assembly. A main assembly contains code and the neutral culture's resources. A satellite assembly contains only resources for a particular culture, as in [assembly:AssemblyCultureAttribute("de")]. Putting this attribute on an assembly and using something other than the empty string ("") for the culture name will make this assembly look like a satellite assembly, rather than a main assembly that contains executable code. Labeling a traditional code library with this attribute will break it, because no other code will be able to find the library's entry points at runtime.

另一个重要的限制是 GAC 可以通过程序集名称、版本、体系结构和公钥 token 来区分程序集,但不能通过文化来区分程序集。附属程序集必须始终存储在本地。

长话短说,从不在包含代码的项目上选择中性以外的任何东西。附属程序集几乎总是从您项目中的资源自动生成,并自动获取适当的 [AssemblyCulture] 属性。

关于c# - 文件详细信息选项卡中的 "Language neutral"属性,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12173293/

相关文章:

ruby-on-rails - 确定名称以 `s` 、 `x` 或 `z` 结尾的最短方法,然后使用 `I18n.t` 方法

c# - WPF - "Center"垂直对齐对负边距的影响

c# - 在 C# 字节数组和 C++ 字节数组之间编码

c# - 将 c++ dLL 的 char 指针数组传递给 c# 字符串

c++ - 整个应用程序的变量

iPhone:即使设置了另一个语言,NSLocalizedString也会从英语.strings文件中读取

c# - 如何使用 C# 检索闪存驱动器的制造商属性

c# - 使用C#从excel表中读取数据

c++ - 用于 dll 注入(inject)的 Win32 窗体

php - 根据语言环境查找第一周和最后一周