如何更改用 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/