共用方式為


How to: Create a Build that Targets a Specific Culture

Microsoft Silverlight will reach end of support after October 2021. Learn more.

You can use the Visual Studio Configuration Manager to define builds to create targeted versions of your localized Silverlight-based application.

To define a localized build

  1. On the Visual Studio Build menu, click Configuration Manager.

  2. In the Configuration Manager dialog box, in the Active Solution Configuration list, click New.

  3. In the New Solution Configuration dialog box, type a name for the new build configuration, and then click an existing configuration from the Copy Settings from list.

    This creates a new build configuration that is identical to an existing configuration. It ensures that the project file contains the correct tags for a successful build.

  4. In Solution Explorer, right-click the project name, and then click Unload Project.

  5. In Solution Explorer, right-click the project name, and then click Edit.

    The project file opens in the Visual Studio XML Editor.

  6. In the project file, find the <PropertyGroup> section that defines the new build configuration you just created.

  7. Add a <SupportedCultures> property to the section, and specify the names of the cultures whose resources should be packaged in the .xap file. Generally, you should include a region-neutral culture (such as "fr") and one or more specific cultures (such as "fr-FR", "fr-BZ", or "fr-CA"). Use a semicolon (;) to separate multiple culture names. For example:

    <SupportedCultures>fr;fr-FR;fr-BZ;fr-CA</SupportedCultures> 
    
  8. In Solution Explorer, right-click the project name, and then click Reload Project.

The build will include the resources of the default culture, as specified in the main assembly, and the resources for the cultures that you designated in the .xap file.