Walkthrough: Downloading Satellite Assemblies on Demand with the ClickOnce Deployment API


The new home for Visual Studio documentation is Visual Studio 2017 Documentation on docs.microsoft.com.

The latest version of this topic can be found at Walkthrough: Downloading Satellite Assemblies on Demand with the ClickOnce Deployment API.

Windows Forms applications can be configured for multiple cultures through the use of satellite assemblies. A satellite assembly is an assembly that contains application resources for a culture other than the application's default culture.

As discussed in Localizing ClickOnce Applications, you can include multiple satellite assemblies for multiple cultures within the same ClickOnce deployment. By default, ClickOnce will download all of the satellite assemblies in your deployment to the client machine, although a single client will probably require only one satellite assembly.

This walkthrough demonstrates how to mark your satellite assemblies as optional, and download only the assembly a client machine needs for its current culture settings. The following procedure uses the tools available in the Windows Software Development Kit (SDK). You can also perform this task in Visual Studio. Also see Walkthrough: Downloading Satellite Assemblies on Demand with the ClickOnce Deployment API Using the Designer or Walkthrough: Downloading Satellite Assemblies on Demand with the ClickOnce Deployment API Using the Designer.

System_CAPS_ICON_note.jpg Note

For testing purposes, the following code example programmatically sets the culture to ja-JP. See the "Next Steps" section later in this topic for information on how to adjust this code for a production environment.

This topic assumes that you know how to add localized resources to your application using Visual Studio. For detailed instructions, see Walkthrough: Localizing Windows Forms.

To download satellite assemblies on demand

  1. Add the following code to your application to enable on-demand downloading of satellite assemblies.

    using System;
    using System.Collections.Generic;
    using System.Windows.Forms;
    using System.Threading;
    using System.Globalization;
    using System.Deployment.Application;
    using System.Reflection;
    namespace ClickOnce.SatelliteAssemblies
        static class Program
            static void Main()
                Thread.CurrentThread.CurrentUICulture = new CultureInfo("ja-JP");
                // Call this before initializing the main form, which will cause the resource manager
                // to look for the appropriate satellite assembly.
                Application.Run(new Form1());
            static void GetSatelliteAssemblies(string groupName)
                if (ApplicationDeployment.IsNetworkDeployed)
                    ApplicationDeployment deploy = ApplicationDeployment.CurrentDeployment;
                    if (deploy.IsFirstRun)
                        catch (DeploymentException de)
                            // Log error. Do not report error to the user, as there may not be a satellite
                            // assembly if the user's culture and the application's default culture match.

  2. Generate satellite assemblies for your application by using Resgen.exe (Resource File Generator) or Visual Studio.

  3. Generate an application manifest, or open your existing application manifest, by using MageUI.exe. For more information about this tool, see MageUI.exe (Manifest Generation and Editing Tool, Graphical Client).

  4. Click the Files tab.

  5. Click the ellipsis button (...) and select the directory containing all of your application's assemblies and files, including the satellite assemblies you generated using Resgen.exe. (A satellite assembly will have a name in the form isoCode\ApplicationName.resources.dll, where isoCode is a language identifier in RFC 1766 format.)

  6. Click Populate to add the files to your deployment.

  7. Select the Optional check box for each satellite assembly.

  8. Set the group field for each satellite assembly to its ISO language identifier. For example, for a Japanese satellite assembly, you would specify a download group name of ja-JP. This will enable the code you added in step 1 to download the appropriate satellite assembly, depending upon the user's CurrentUICulture property setting.

In a production environment, you will likely need to remove the line in the code example that sets CurrentUICulture to a specific value, because client machines will have the correct value set by default. When your application runs on a Japanese client machine, for example, CurrentUICulture will be ja-JP by default. Setting this value programmatically is a good way to test your satellite assemblies before you deploy your application.

Localizing ClickOnce Applications