.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 our discussion on locating satellite assemblies, we'll focus on as they pertain to ASP.NET. Because ASP.NET pages and controls are dynamically compiled, you must create an assembly containing the default resources. This assembly is known as a parallel main assembly, and should be placed in the bin directory. From there, satellite assemblies should be placed in subdirectories beneath the bin named according to the culture. For example, a satellite assembly containing Japanese resources should be placed in a subdirect called ja, the standard two-letter culture code. The following diagram from the .NET Framework documentation shows a sample ASP.NET application with multiple satellite assemblies.

Additional Resources

  • Creating Satellite Assemblies