You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# Build resources into your app package, instead of into a resource pack
12
+
# Build resources into your app package instead of into a resource pack
13
13
14
-
Some kinds of apps (multilingual dictionaries, translation tools, etc.) need to override the default behavior of an app bundle, and build resources into the app package instead of having them in separate resource packages (or resource packs). This topic explains how to do that.
14
+
Some kinds of apps (multilingual dictionaries, translation tools, etc.) need to override the default behavior of an app bundle and build resources into the app package instead of having them in separate resource packages (or resource packs). This topic explains how to do that.
15
15
16
-
By default when you build an [app bundle (.appxbundle)](/windows/msix/package/packaging-uwp-apps), only your default resources for language, scale, and DirectX feature level are built into the app package. Your translated resources—and your resources tailored for non-default scales and/or DirectX feature levels—are built into resource packages and they are only downloaded onto devices that need them. If a customer is buying your app from the Microsoft Store using a device with a language preference set to Spanish, then only your app plus the Spanish resource package are downloaded and installed. If that same user later changes their language preference to French in **Settings**, then your app's French resource package is downloaded and installed. Similar things happen with your resources qualified for scale and for DirectX feature level. For the majority of apps, this behavior constitutes a valuable efficiency, and it's exactly what you and the customer *want* to happen.
16
+
By default, when you build an [app bundle (.appxbundle)](/windows/msix/package/packaging-uwp-apps), only your default resources for language, scale, and DirectX feature level are built into the app package. Your translated resources—and your resources tailored for non-default scales and/or DirectX feature levels—are built into resource packages, and they are only downloaded onto devices that need them. If a customer is buying your app from the Microsoft Store using a device with a language preference set to Spanish, then only your app plus the Spanish resource package are downloaded and installed. If that same user later changes their language preference to French in **Settings**, then your app's French resource package is downloaded and installed. Similar things happen with your resources qualified for scale and for DirectX feature level. For the majority of apps, this behavior constitutes a valuable efficiency, and it's what you and the customer *want* to happen.
17
17
18
18
But if your app allows the user to change the language on the fly from within the app (instead of via **Settings**), then that default behavior is not appropriate. You actually want all of your language resources to be unconditionally downloaded and installed along with the app one time, and then remain on the device. You want to build all of those resources into your app package instead of into separate resource packages.
19
19
20
20
**Note** Including resources in an app package essentially increases the size of the app. That's why it's only worth doing if the nature of the app demands it. If not, then you don't need to do anything except build a regular app bundle as usual.
21
21
22
-
You can configure Visual Studio to build resources into your app package in one of two ways. You can either add a configuration file to your project, or you can edit your project file directly. Use whichever of these options you're most comfortable with, or whichever works best with your build system.
22
+
You can configure Visual Studio to build resources into your app package in one of two ways. You can either add a configuration file to your project or you can edit your project file directly. Use whichever of these options you're most comfortable with or whichever works best with your build system.
23
23
24
24
## Option 1. Use priconfig.packaging.xml to build resources into your app package
25
25
@@ -33,7 +33,7 @@ You can configure Visual Studio to build resources into your app package in one
33
33
<autoResourcePackagequalifier="DXFeatureLevel" />
34
34
</packaging>
35
35
```
36
-
4. Each `<autoResourcePackage>` element tells Visual Studio to automatically split the resources for the given qualifier name out into separate resource packages. This is called *auto-splitting*. With the file contents you have so far, you haven't actually changed Visual Studio's behavior. In other words, Visual Studio *already behaved as if* this file were present with these contents, because these are the defaults. If you don't want Visual Studio to auto-split on a qualifier name then delete that `<autoResourcePackage>` element from the file. Here's how the file would look if you wanted all of your language resources to be built into the app package instead of being auto-split out into separate resource packages.
36
+
4. Each `<autoResourcePackage>` element tells Visual Studio to automatically split the resources for the given qualifier name out into separate resource packages. This is called *auto-splitting*. With the file contents you have so far, you haven't actually changed Visual Studio's behavior. In other words, Visual Studio *already behaved as if* this file were present with these contents because these are the defaults. If you don't want Visual Studio to auto-split on a qualifier name, then delete that `<autoResourcePackage>` element from the file. Here's how the file would look if you wanted all of your language resources to be built into the app package instead of being auto-split out into separate resource packages.
37
37
```xml
38
38
<packaging>
39
39
<autoResourcePackagequalifier="Scale" />
@@ -44,7 +44,7 @@ You can configure Visual Studio to build resources into your app package in one
44
44
45
45
To confirm that your auto-split choices are being taken into account, look for the file `<ProjectFolder>\obj\<ReleaseConfiguration folder>\split.priconfig.xml` and confirm that its contents match your choices. If they do, then you have successfully configured Visual Studio to build the resources of your choice into the app package.
46
46
47
-
There is one final step that you need to do. **But only if you deleted the `Language` qualifier name**. You need to specify the union of all of your app's supported language as your app's default for language. For details, see [Specify the default resources that your app uses](specify-default-resources-installed.md). This is what your `priconfig.default.xml` would contain if you were including resources for English, Spanish, and French in your app package.
47
+
There is one final step that you need to do. **But only if you deleted the `Language` qualifier name**. You need to specify the union of all of your app's supported languages as your app's default language. For details, see [Specify the default resources that your app uses](specify-default-resources-installed.md). This is what your `priconfig.default.xml` would contain if you were including resources for English, Spanish, and French in your app package.
48
48
49
49
```xml
50
50
<default>
@@ -65,27 +65,27 @@ If you name your file `priconfig.packaging.xml`, then Visual Studio will recogni
Replace `FILE-PATH-AND-NAME` with the path to, and name of, your file.
68
+
Replace `FILE-PATH-AND-NAME` with the path to and name of your file.
69
69
70
70
## Option 2. Use your project file to build resources into your app package
71
71
72
-
This is an alternative to Option 1. Once you understand how Option 1 works, you can choose to do Option 2 instead, if that suits your development and/or build workflow better.
72
+
This is an alternative to Option 1. Once you understand how Option 1 works, you can choose to do Option 2 instead if that suits your development and/or build workflow better.
73
73
74
74
In your project file, between the opening and closing tags of the first `<PropertyGroup>` element, add this XML.
There is one final step that you need to do. **But only if you deleted the `Language` qualifier name**. You need to specify the union of all of your app's supported language as your app's default for language. For details, see [Specify the default resources that your app uses](specify-default-resources-installed.md). This is what your project file would contain if you were including resources for English, Spanish, and French in your app package.
88
+
There is one final step that you need to do. **But only if you deleted the `Language` qualifier name**. You need to specify the union of all of your app's supported languages as your app's default language. For details, see [Specify the default resources that your app uses](specify-default-resources-installed.md). This is what your project file would contain if you included resources for English, Spanish, and French in your app package.
0 commit comments