.netCoders Contact Us
Search:

Assemblies

Assemblies are units of versioning and deployment in .NET. Normally, assemblies contain executable code. However, assemblies can also be made by just using resources (non-executable data). These types of assemblies are called satellite assemblies. Resources are often used for localization. Without recompiling your application, you can change messages for a foreign audience.

Creating Satellite Assemblies

You can create a satellite assembly by creating an empty project in Visual Studio.NET, then selecting File->Add New Item and choosing Assembly Resource File (.resx) from the Add New Item dialog. Remember when creating satellite assemblies, you should create one assembly for each culture. The reason for this is how the .NET runtime locates satellite assemblies. Build the application to a class library (ie. dll).

You should also be familiar with how to manually create a satellite assembly from a resource file using the Assembly Linker Tool (al.exe). The syntax for the the Assembly Linker tool is demonstrated in the following example. Notice that resources are included via the /embed switch, and the culture is indicated with the /culture switch.

al /t:lib /culture:ja /out:YourApp.resources.dll /embed:strings.ja.resources

Locating Satellite Assemblies

For a Windows application to locate satellite assemblies, a specific naming convention must be used. Your application should include a default resources file located in the directory of your application, so that there is always a fallback localization. Additional satellite assemblies should be placed in subdirectories beneath application directory and named according to the culture. For example, a satellite assembly containing Japanese resources should be placed in a subdirectory called ja, the standard two-letter culture code. The following diagram from the .NET Framework documentation shows a sample WinForms application with multiple satellite assemblies.

Additional Resources

  • Creating Satellite Assemblies