为什么makepri.exe创建多个Resources.pri文件?

时间:2016-07-21 14:19:42

标签: windows-10 uwp

我正在尝试创建一个Resources.pri文件,以便Windows 10知道哪些图像用于不同分辨率的起始图块。我按照以下链接的MSDN文档的第6步进行操作:

https://msdn.microsoft.com/en-us/library/windows/apps/dn393983.aspx#Specify_images_for_scaling__localization__and_high_contrast

我的所有徽标图片都根据其比例标记。这些是我的Assets文件夹中的名称:

70x70Logo.scale-80.png
70x70Logo.scale-100.png
70x70Logo.scale-140.png
70x70Logo.scale-180.png
150x150Logo.scale-80.png
150x150Logo.scale-100.png
150x150Logo.scale-140.png
150x150Logo.scale-180.png

当我手动使用makepri.exe时,它会创建三个Resources.pri文件,而不只是一个包含我想要的所有缩放信息的文件。这些是生成的文件:

Resources.pri
Resources.scale-140.pri
Resources.scale-180.pri

Resources.pri包含80%和100%比例的信息,但其他两个文件包含140%和180%比例的信息。知道为什么更大的尺度被分成单独的文件吗?我已经包含在我的TestAppConfig.xml文件下面,以及我使用生成文件的命令。

TestAppConfig.xml

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<resources targetOsVersion="10.0.0" majorVersion="1">
    <packaging>
        <autoResourcePackage qualifier="Language"/>
        <autoResourcePackage qualifier="Scale"/>
        <autoResourcePackage qualifier="DXFeatureLevel"/>
    </packaging>
    <index root="\" startIndexAt="\">
        <default>
            <qualifier name="Language" value="en-US"/>
            <qualifier name="scale" value="100"/>
        </default>
        <indexer-config type="folder" foldernameAsQualifier="true" filenameAsQualifier="true" qualifierDelimiter="."/>
        <indexer-config type="resw" convertDotsToSlashes="true" initialPath=""/>
        <indexer-config type="resjson" initialPath=""/>
        <indexer-config type="PRI"/>
    </index>
    <!--<index startIndexAt="Start Index Here" root="Root Here">-->
    <!--        <indexer-config type="resfiles" qualifierDelimiter="."/>-->
    <!--        <indexer-config type="priinfo" emitStrings="true" emitPaths="true" emitEmbeddedData="true"/>-->
    <!--</index>-->
</resources>

创建TestAppConfig.xml的命令

"C:\Program Files (x86)\Windows Kits\10\bin\x86\makepri.exe" createconfig /cf %USERPROFILE%\Documents\TestAppConfig.xml /dq lang-en-US_scale-100_contrast-high /pv 10.0.0

创建Resources.pri

的命令
"C:\Program Files (x86)\Windows Kits\10\bin\x86\makepri.exe" new /pr %USERPROFILE%\Documents\CreateResources /cf %USERPROFILE%\Documents\TestAppConfig.xml /in TestApp /of %USERPROFILE%\Documents\CreateResources\Resources.pri

非常感谢对此的任何见解!如果我能提供更多细节,请告诉我。

2 个答案:

答案 0 :(得分:3)

我最终找到了一个解决方案,尽管我确切地知道为什么它只需要创建一个Resources.pri文件。我发现设置所有图像的默认语言允许makepri.exe将所有图像比例添加为一个Resources.pri文件的候选资源。例如,我发现这个文件结构有效:

\Assets
    \en-US
        70x70Logo.scale-80.png
        70x70Logo.scale-100.png
        70x70Logo.scale-140.png
        70x70Logo.scale-180.png
        150x150Logo.scale-80.png
        150x150Logo.scale-100.png
        150x150Logo.scale-140.png
        150x150Logo.scale-180.png

我被这段文档片段所吸引:

  

注意我们建议您在字符串资源文件(例如en-US \ resources.resw)和图像上的默认比例(例如logo.scale-100.png)上标记默认语言,即使这些文件将会没有本地化,也没有提供多个分辨率的图像

https://msdn.microsoft.com/en-us/library/windows/apps/hh965372.aspx

去图。

我希望其他人觉得这很有帮助。如果有人对makepri.exe以这种方式工作的原因有任何了解,我很想知道更多。

答案 1 :(得分:3)

我刚刚用语言而不是图像遇到过这种情况,但是从自动生成的makepri配置中删除这个块为我修复了它:

<packaging>
    <autoResourcePackage qualifier="Language"/>
    <autoResourcePackage qualifier="Scale"/>
    <autoResourcePackage qualifier="DXFeatureLevel"/>
</packaging>