开发者

In a C# class project, what is AssemblyCulture used for?

开发者 https://www.devze.com 2023-04-05 01:29 出处:网络
Within a C#开发者_StackOverflow class project, there\'s the Properties file called AssemblyInfo.cs. Within this file are a series of assembly attributes including AssemblyTitle, AssemblyDescription, a

Within a C#开发者_StackOverflow class project, there's the Properties file called AssemblyInfo.cs. Within this file are a series of assembly attributes including AssemblyTitle, AssemblyDescription, and so on, which are used to describe certain details about the compiled project. One of these is AssemblyCulture.

I understand what the others are used for, but What is AssemblyCulture used to describe? Language? Currency? A bit of both?

Whenever I've seen this property, it's been left blank.


From the documentation:

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.

To summarize: This attribute is used internally by the framework to mark the satellite assemblies automatically created when you add localized resources to your project. You will probably never need to manually set this attribute to anything other than "".


Quote from the documentation:

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.


When I googled your question I came up with a quick answer from this tutorial. It has a small description which I'm providing below and it looks like that's where you can specify localization but I'm not sure how much work it does for your assembly.

AssemblyCultureAttribute Class implements AssemblyCulture attribute which is used to specify culture of an assembly as well as indicte that this is not a main assembly but rather its satellite.

[assembly: AssemblyCulture("de")] // German
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号