Sonic78
Sonic78

Reputation: 808

Does Platform Target (x86/x64/AnyCPU) matter for.net satellite assemblies

When a .NET application provides a user interface, resources that are language specific (like texts), are provided with .net resource/satellite assemblies. The text resources for different languages are then provided by different assemblies. When a satellite assemblies contains only resources and no code that has to be executed/compiled for a specific platform - is the target platform (x86/x64/AnyCPU) important or is it ignored?

Upvotes: 2

Views: 255

Answers (1)

Yennefer
Yennefer

Reputation: 6234

For pure assemblies (those not unsafe, and not using interop) , the bitness is a bit in the manifest, and does not affect code generation. Pure satellite assemblies should target any cpu for this reason.

The bitness of a c# process is inferred by how it is launched together with the bitness flag: for this reasons, entry point assemblies should target any cpu only when pure assemblies are used in the whole application and no side effect exists when running on a platform rather than the other. In all the other cases, they should target the correct platform.

The bitness is not ignored during assembly probing, hence if a 32bit executable requires a 64 bit assembly, the assembly will not be found and an exception is thrown. Platform agnostic assemblies are consideted to be "as the process expects them".

Upvotes: 1

Related Questions