abhi294074
abhi294074

Reputation: 257

.NET Assembly Culture

How do you change the assembly language in a C# application? There is a problem when we are using

[assembly:AssemblyCulture("en-US")]

There is an error:

Error emitting'System.Reflection.AssemblyCultureAttribute' attribute -- 'Executables cannot be satellite assemblies, Culture should always be empty'

Upvotes: 10

Views: 16174

Answers (2)

Ammar Abdul Wadood
Ammar Abdul Wadood

Reputation: 59

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 "".

ref: https://stackoverflow.com/questions/7402206/in-a-c-sharp-class-project-what-is-assemblyculture-used-for

Upvotes: 1

Lex Li
Lex Li

Reputation: 63244

You should use

[assembly: AssemblyCulture("")] 

as the compiler suggests.

To define default culture, you should use

[assembly: NeutralResourcesLanguage("en-US")]

Upvotes: 13

Related Questions