MakePri.exe 命令行选项MakePri.exe command-line options

MakePri.exe 包含一组命令 createconfigdumpnewresourcepackversionedMakePri.exe has the set of commands createconfig, dump, new, resourcepack, and versioned. 本主题对命令行选项的使用进行详细介绍。This topic details the command-line options for their use.

备注

当你在安装 Windows 软件开发工具包时检查 UWP 托管应用的 Windows SDK 选项时,会安装 MakePri.exe。MakePri.exe is installed when you check the Windows SDK for UWP Managed Apps option while installing the Windows Software Development Kit. 它将安装到 (的路径 %WindowsSdkDir%bin\<WindowsTargetPlatformVersion>\x64\makepri.exe 和其他体系结构) 的文件夹中。It is installed to the path %WindowsSdkDir%bin\<WindowsTargetPlatformVersion>\x64\makepri.exe (as well as in folders named for the other architectures). 例如 C:\Program Files (x86)\Windows Kits\10\bin\10.0.17713.0\x64\makepri.exeFor example, C:\Program Files (x86)\Windows Kits\10\bin\10.0.17713.0\x64\makepri.exe.

从命令行中获取帮助Getting help from the command-line

您可以运行 MakePri.exe helpMakePri.exe /? 以查看可用于 MakePri.exe 的命令。You can run MakePri.exe help or MakePri.exe /? to see the commands that you can use with MakePri.exe. 您还可以发出 MakePri.exe <command> /? 有关命令的详细信息,并在极少数情况下查看有关 MakePri.exe <command> <option> 选项的具体信息。You can also issue MakePri.exe <command> /? to see specifics about a command and, in very rare cases, even MakePri.exe <command> <option> to see specifics about an option.

MakePri 命令MakePri commands

C:\>makepri help

Usage:
------
    MakePri.exe <command> [options]

Example:
--------
    MakePri.exe new /cf C:\MyApp\priconfig.xml /pr C:\MyApp\src\ /in PackageName

Description:
------------
    Creates, dumps, and performs utility functions on a PRI file. A PRI file is 
    an index of application resources, such as strings and image files.

Command Options:
----------------
    MakePri.exe createconfig   Creates a PRI config file for use with other
                               commands
    MakePri.exe dump           Dumps the contents of a PRI file
    MakePri.exe new            Creates a new PRI file from scratch
    MakePri.exe resourcepack   Creates a PRI file that contains additional
                               resource variants for a base PRI file
    MakePri.exe versioned      Creates a PRI file based on a previous version

Help:
-----
    MakePri.exe help           Show this help page
    MakePri.exe <command> /?   Shows detailed help for <command>

    For example,
    MakePri.exe createconfig /?

Createconfig 命令Createconfig command

createconfig 命令创建一个新的初始化 PRI 配置文件,该文件定义你指定的限定符默认值。The createconfig command creates a new, initialized PRI config file defining the qualifier defaults that you specify. 运行 MakePri.exe createconfig /? 以查看关于此命令的详细帮助。Run MakePri.exe createconfig /? to see detailed help for this command.

C:\>makepri createconfig /?

Usage:
------
    MakePri.exe createconfig /cf <config file destination> /dq
    <default qualifiers> [options]

Example:
--------
    MakePri.exe createconfig /cf C:\MyApp\priconfig.xml /dq lang-en-US /o /pv 10.0.0

Description:
------------
    Creates a PRI configuration file at <config file destination> with default 
    qualifiers specified by <default qualifiers>. Multiple qualifiers are separated 
    by underscores (_)

Required Parameters:
--------------------
    /ConfigXml(cf)    : <FILEPATH> Configuration file output location
    /Default(dq)      : <QUALIFIERS> The default qualifiers to set in the
                        configuration file. A language qualifier is required

Options:
--------
    /ExtensionDll(ex) : <FILEPATH> Location of the Resource Management System
                        environment extension DLL. This DLL must be signed by
                        a Microsoft-issued certificate. Default is an empty path
                        (no DLL will be used)
    /Overwrite(o)     : Overwrite an existing output file of the same name
                        without prompting
    /Platform(pv)     : <VERSION> Platform version to use for generated
                        configuration file

    FILEPATH          - a path to a file, either relative to the current
                        directory or absolute
    QUALIFIERS        - a valid qualifier token
                        (for example, lang-en-US_scale-100_contrast-high)

Help:
-----
    /Help(h, ?)       : Display the usage help text

Dump 命令Dump command

dump 命令输入一个转储文件,该文件包含指定 PRI 文件中的所有资源的列表。The dump command outputs a dumped xml file containing a list of all resources in a specified PRI file. 运行 MakePri.exe dump /? 以查看关于此命令的详细帮助。Run MakePri.exe dump /? to see detailed help for this command.

备注

无模式资源包是在 PRI 配置文件中使用 omitSchemaFromResourcePacks 开关创建的资源包。A schema-free resource pack is one that was created with the omitSchemaFromResourcePacks switch in the PRI config file. 若要转储无模式资源包,请使用开关 /es <main_package_PRI_file>To dump a schema-free resource pack, use the switch /es <main_package_PRI_file>. 如果不指定主文件,则会看到错误消息“ 程序包中的 resources.pri 已损坏,因此加密失败(错误 PRI222:0xdef0000f - 发生未知错误) ”。If you don't specify the main file then you'll see the error message " The resources.pri in the package was corrupted so encryption failed (error PRI222: 0xdef0000f - Unspecified error occurred) ".

C:\>makepri dump /?

Usage:
------
    MakePri.exe dump [options]

Example:
--------
    MakePri.exe dump /if C:\MyApp\resources.pri /of C:\resources.pri.xml

Description:
------------
    Outputs a dumped xml file at <output file> containing a list of all 
    resources in <index file>.

Options:
--------
    /DumpType(dt)       : <STRING> Format of the dumped file, default is
                          Basic
    /ExtensionDll(ex)   : <FILEPATH> Location of the Resource Management System
                          environment extension DLL. This DLL must be signed by a
                          Microsoft-issued certificate. Default is an empty path
                          (no DLL will be used)
    /ExternalSchema(es) : <FILEPATH> Location of the external schema file
    /IndexFile(if)      : <FILEPATH> Location of the PRI file to dump from.
                          Default is .\resources.pri
    /OutputFile(of)     : <FILEPATH> Output location of the dump file, default
                          is .\[indexfile].xml
    /OutputOptions(oo)  : <OPTIONS> Options to provide detailed control over
                          contents of XML output files.
    /Overwrite(o)       : Overwrite an existing output file of the same name
                          without prompting
    /Verbose(v)         : Causes verbose messages to be output to the console

    Dump Type:
        Either 'Basic', 'Detailed', 'Schema', or 'Summary'

    FILEPATH            - a path to a file, either relative to the current
                          directory or absolute
Help:
-----
    /Help(h, ?)         : Display the usage help text

新命令New command

new 命令通过按照你的配置文件的指示索引你的项目中的文件的方式创建一个新的 PRI 文件。The new command creates a new PRI file by indexing the files in your project as directed by your configuration file. 运行 MakePri.exe new /? 以查看关于此命令的详细帮助。Run MakePri.exe new /? to see detailed help for this command.

C:\>makepri new /?

Usage:
------
    MakePri.exe new /cf <config file> /pr <project root> [options]

Example:
--------
    MakePri.exe new /cf C:\MyApp\priconfig.xml /pr C:\MyApp\src\ 
    /mn C:\MyApp\AppXManifest.xml /o /of C:\MyApp\src\resources.pri

Description:
------------
    Creates a PRI file at <output file> by indexing all files in
    <project root> and its subdirectories as directed by <config file>. The
    index will be assigned <index name> to reference resources in the app

Required Parameters:
--------------------
    /ConfigXml(cf)    : <FILEPATH> Configuration file location. Use the
                        'Makepri.exe createconfig' command to generate one
    /ProjectRoot(pr)  : <FOLDERPATH> Root location of project files

Options:
--------
    /AutoMerge(am)    : This flag is not recommended for normal use with .appx
                        packages. It causes Makepri.exe to set the auto
                        merge flag within the PRI file. Default is not set.
    /ExtensionDll(ex) : <FILEPATH> Location of the Resource Management System
                        environment extension DLL. This DLL must be signed by
                        a Microsoft-issued certificate. Default is an empty path
                        (no DLL will be used)
    /IndexLog(il)     : <FILEPATH> XML Log of indexed resources, no file
                        generated by default
    /IndexName(in)    : <STRING> Name for the generated index of resources.
                        Typically matches the .appx package name, class library
                        simple name, etc. May be supplied via the
                        [manifest] parameter.
    /IndexOptions(io) : <OPTIONS> Options to provide detailed control over
                        behavior of resource indexers.
    /Manifest(mn)     : <FILEPATH> Location of the application or component's
                        manifest. This parameter is ignored if [indexname]
                        is given. Default is [projectroot]\AppXManifest.xml
    /MappingFile(mf)  : <MAPPINGFILETYPE> Generate a mapping file in the given
                        file format.
    /OutputFile(of)   : <FILEPATH> Output location of PRI file, default is
                        .\resources.pri
    /Overwrite(o)     : Overwrite an existing output file of the same name
                        without prompting
    /ReverseMap(rm)   : Generate a reverse mapping section in the PRI file
                        which can be used for debugging purposes.
    /SchemaFile(sf)   : <FILEPATH> Output location of XML resource schema
                        description.
    /Verbose(v)       : Causes verbose messages to be output to the console
    /VersionMajor(vma): <INTEGER> [Deprecated] Major version number for
                        index, default is 1

    FOLDERPATH        - a path to a folder
    FILEPATH          - a path to a file, either relative to the current
                        directory or absolute
    MAPPINGFILETYPE   - Supported File type(s): 'AppX'

Help:
-----
    /Help(h, ?)        : Display the usage help text

ResourcePack 命令ResourcePack command

resourcepack 命令通过按照你的配置文件的指示索引你的项目中的文件的方式创建一个新的 PRI 文件。The resourcepack command creates a new PRI file by indexing the files in your project as directed by your configuration file. 资源包 PRI 文件仅包含在现有 PRI 文件中已经指定的资源的其他变体。A resource pack PRI file contains only additional variants of resources already specified in an existing PRI file. 运行 MakePri.exe resourcepack /? 以查看关于此命令的详细帮助。Run MakePri.exe resourcepack /? to see detailed help for this command.

C:\>makepri resourcepack /?

Usage:
------
    MakePri.exe resourcepack /pr <project root> /cf <config file> [options]

Example:
--------
    MakePri.exe resourcepack /cf C:\MyAppEs\priconfig.xml /pr C:\MyAppEs\src\ 
    /if C:\MyApp\1.2\resources.pri /o /of C:\MyAppEs\resources.pri

Description:
------------
    Creates a PRI file at <output file> by indexing all files in 
    <project root> and its subdirectories as directed by <config file>. A 
    resource pack PRI file contains only additional variants of resources 
    already specified in <index file>.

Required Parameters:
--------------------
    /ConfigXml(cf)    : <FILEPATH> Configuration file location. Use
                        'Makepri.exe createconfig' command to generate one
    /ProjectRoot(pr)  : <FOLDERPATH> Root location of project files

Options:
--------
    /AutoMerge(am)    : This flag is not recommended for normal use with .appx
                        packages. It causes Makepri.exe to set the auto
                        merge flag within the PRI file. By default it is set
                        to same as the base PRI file.
    /ExtensionDll(ex) : <FILEPATH> Location of the Resource Management System
                        environment extension DLL. This DLL must be signed by
                        a Microsoft-issued certificate. Default is an empty path
                        (no DLL will be used)
    /IndexFile(if)    : <FILEPATH> Location of the base PRI or XML schema file.
                        Default is <ProjectRoot>\resources.pri
    /IndexLog(il)     : <FILEPATH> XML Log of indexed resources, no file
                        generated by default
    /IndexOptions(io) : <OPTIONS> Options to provide detailed control over
                        behavior of resource indexers.
    /MappingFile(mf)  : <MAPPINGFILETYPE> Generate a mapping file in the given
                        file format.
    /OutputFile(of)   : <FILEPATH> Output location of PRI file, default is
                        .\resources.pri
    /Overwrite(o)     : Overwrite an existing output file of the same name
                        without prompting
    /ReverseMap(rm)   : Generate a reverse mapping section in the PRI file
                        which can be used for debugging purposes.
    /SchemaFile(sf)   : <FILEPATH> Output location of XML resource schema
                        description.
    /Verbose(v)       : Causes verbose messages to be output to the console

    FOLDERPATH        - a path to a folder
    FILEPATH          - a path to a file, either relative to the current
                        directory or absolute
    MAPPINGFILETYPE   - Supported File type(s): 'AppX'

Help:
-----
    /Help(h, ?)        : Display the usage help text

Versioned 命令Versioned command

versioned 命令通过按照你的配置文件的指示索引你的项目中的文件的方式创建一个版本化的 PRI 文件。The versioned command creates a versioned PRI file by indexing the files in your project as directed by your configuration file. 运行 MakePri.exe versioned /? 以查看关于此命令的详细帮助。Run MakePri.exe versioned /? to see detailed help for this command.

C:\>makepri versioned /?

Usage:
------
    MakePri.exe versioned /cf <config file> /pr <project root> [options]

Example:
--------
    MakePri.exe versioned /cf C:\MyApp\priconfig.xml /pr C:\MyApp\src 
    /if C:\MyApp\1.2\resources.pri /o /of C:\MyApp\src\resources.pri /o

Description:
------------
    Creates a versioned PRI file at <output file> by indexing all files in 
    <project root> and its subdirectories as directed by <config file>.

Required Parameters:
--------------------
    /ConfigXml(cf)    : <FILEPATH> Configuration file location. Use
                        'Makepri.exe createconfig' command to generate one
    /ProjectRoot(pr)  : <FOLDERPATH> Root location of project files

Options:
--------
    /AutoMerge(am)    : This flag is not recommended for normal use with .appx
                        packages. It causes Makepri.exe to set the auto
                        merge flag within the PRI file. By default it is set
                        to same as the base PRI file.
    /ExtensionDll(ex) : <FILEPATH> Location of the Resource Management System
                        environment extension DLL. This DLL must be signed by
                        a Microsoft-issued certificate. Default is an empty path
                        (no DLL will be used)
    /IndexFile(if)    : <FILEPATH> Location of the base PRI or XML schema file
                        to version from. Default is <ProjectRoot>\resources.pri
    /IndexLog(il)     : <FILEPATH> XML Log of indexed resources, no file
                        generated by default
    /IndexOptions(io) : <OPTIONS> Options to provide detailed control over
                        behavior of resource indexers.
    /MappingFile(mf)  : <MAPPINGFILETYPE> Generate a mapping file in the given
                        file format.
    /OutputFile(of)   : <FILEPATH> Output location of PRI file, default is
                        [current directory]\resources.pri
    /Overwrite(o)     : Overwrite an existing output file of the same name
                        without prompting
    /ReverseMap(rm)   : Generate a reverse mapping section in the PRI file
                        which can be used for debugging purposes.
    /SchemaFile(sf)   : <FILEPATH> Output location of XML resource schema
                        description.
    /Verbose(v)       : Causes verbose messages to be output to the console

    FOLDERPATH        - a path to a folder
    FILEPATH          - a path to a file, either relative to the current
                        directory or absolute
    MAPPINGFILETYPE   - Supported File type(s): 'AppX'

Help:
-----
    /Help(h, ?)        : Display the usage help text

/ExtensionDll(ex)/ExtensionDll(ex)

你使用扩展 DLL 选项 (/ex) 与 createconfigdumpnewresourcepackversioned 一起指定资源管理系统环境扩展 DLL 的位置。You use the extension DLL option (/ex) with createconfig, dump, new, resourcepack, and versioned to specify the location of the Resource Management System environment extension DLL.

Logging/metadata 文件Logging/metadata file

MakePri 可以将资源包特定的信息包括在索引器元数据文件中。MakePri can include info specific to a resource pack in the indexer metadata file. 下面是具有资源 PRI 文件 german.prihighresolution.priresources.pri 的日志文件的示例。Here is an example of a log file for resources.pri with resource PRI files german.pri and highresolution.pri.

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<root>
  <package filename="resources.pri">
    <instance itemname="Files\logo.jpg" qualifiers="Scale-100" src="" type="Path">
      <value>logo.scale-100.jpg</value>
    </instance>
    <instance itemname="resources\string2" qualifiers="Language-en-us" src="C:\Users\alias\Desktop\repro\app4\project\en-us\resources.resw" type="String">
      <value>value2</value>
    </instance>
    <instance itemname="resources\string1" qualifiers="Language-en-us" src="C:\Users\alias\Desktop\repro\app4\project\en-us\resources.resw" type="String">
      <value>value1</value>
    </instance>
  </package>
  <package filename="german.pri">
    <instance itemname="resources\string2" qualifiers="Language-de-de" src="C:\Users\alias\Desktop\repro\app4\project\de-de\resources.resw" type="String">
      <value>value2</value>
    </instance>
    <instance itemname="resources\string1" qualifiers="Language-de-de" src="C:\Users\alias\Desktop\repro\app4\project\de-de\resources.resw" type="String">
      <value>value1</value>
    </instance>
  </package>
  <package filename="highresolution.pri">
    <instance itemname="Files\logo.jpg" qualifiers="Scale-200" src="" type="Path">
      <value>logo.scale-200.jpg</value>
    </instance>
  </package>
</root>

/IndexFile(if) 选项/IndexFile(if) option

你使用索引文件选项 (/if) 与 dumpresourcepackversioned 一起指定输入的 PRI 文件。You use the index file option (/if) with dump, resourcepack, and versioned to specify an input PRI file.

对于 resourcepackversioned,你可以不提供 PRI 文件作为 /IndexFile(if) 的输入参数,而是提供架构文件。For resourcepack and versioned, instead of providing a PRI file as the input parameter for /IndexFile(if), you can instead provide a schema file.

/IndexFile(if) <FILEPATH>

FILEPATH 是指定输入的 PRI 文件或 PRI 架构文件位置的标记。FILEPATH is a token that that specifies the location of the input PRI file or PRI schema file.

/IndexOptions (io) 选项/IndexOptions(io) option

使用索引选项选项 (/io) new ,以及、 resourcepackversioned 来指定提供对资源索引器行为的详细控制的选项。You use the index options option (/io) with new, resourcepack, and versioned to specify options that provide detailed control over the behavior of resource indexers. 索引选项默认情况下处于禁用状态。Index options are disabled by default.

/IndexOptions(io) <OPTIONS>

Options 是一个以逗号分隔的列表,其中包含以下选项。OPTIONS is a comma-separated list comprised of the following options.

  • +/-HiddenFiles (hf) 。+/-HiddenFiles(hf). Index (+) 或忽略 ( ) 隐藏文件和文件夹。Index (+) or ignore (-) hidden files and folders.
  • +/-LinkedFiles (lf) 。+/-LinkedFiles(lf). Index (+) 或忽略 (-) 链接文件和文件夹。Index (+) or ignore (-) linked files and folders.

/MappingFile(mf) 选项/MappingFile(mf) option

你可以使用映射文件选项 (/mf) 与 newresourcepackversioned 一起生成映射文件。You use the mapping file option (/mf) with new, resourcepack, and versioned to generate a mapping file. MakeAppx.exe 使用映射文件生成应用包。MakeAppx.exe uses the mapping file to generate app packages.

/MappingFile(mf) <MAPPINGFILETYPE>

MAPPINGFILETYPE 是指定映射文件格式的标记。MAPPINGFILETYPE is a token that specifies the format of the mapping file. 唯一受支持的有效格式为 appxThe only valid supported format is appx.

/mf appx

这是主要映射文件内容的示例。This is an example contents of a main mapping file.

"ResourceDimensions"                   "language-de-de"

这是资源包映射文件内容的示例。And this is an example contents of a resource pack mapping file.

"ResourceId"                           "Resources184.la5decaf08"
"ResourceDimensions"                   "language-de-de"

输出摘要Output summary

如果创建资源包,来自 MakePRI.exe 的输出摘要采用更加详细的窗体。If resource packs are created, the output summary from MakePRI.exe is of more verbose form. 下面是一个示例。Here's an example.

Index Pass Completed: ResourcePackTests\TestApp_ResourcePack
Language Qualifiers: fr-FR, de-DE

Finished building
Version: 1.0
Resource Map Name: AppTest
Named Resources: 11

Resource PRI: fr-FR.pri
Version: 1.0
Resource Candidates: 4
Language: fr-FR

Resource PRI: de-DE.pri
Version: 1.0
Resource Candidates: 4
Language: de-DE

Output File(s) at TempTestResults
Successfully Completed

/Overwrite(o) 选项/Overwrite(o) option

如果未提供覆盖选项 (/o),且已经存在指定的输出文件,则 MakePri.exe 在覆盖前需要确认。If the over-write option (/o) is not provided, and the specified output file(s) already exist(s), then MakePri.exe requires a confirmation before overwriting.

Following file(s) already exist at output location:
<file(s)>
Overwrite these file(s)? [Y]es (any other key to cancel):

/OutputFile(of) 选项/OutputFile(of) option

你使用输出文件选项 (/of) 与 dumpnewresourcepackversioned 一起指定要生成的 PRI 文件的输出位置和名称。You use the output file option (/of) with dump, new, resourcepack, and versioned to specify the output location and name of the PRI file to be generated. 如果 MakePri.exe 生成多个资源 PRI 文件,它将它们放在目标文件的父文件夹中。If MakePri.exe generates more than one resource PRI file, it places them in the parent folder of the target file. 例如,如果你指定了 /of MyParentFolder\TargetFile.pri,则 MakePri.exe 在 ParentFolder 下生成 TargetFile.language-en.priTargetFile.scale-100.pri 以及 TargetFile.priFor example, if you specify /of MyParentFolder\TargetFile.pri then MakePri.exe generates TargetFile.language-en.pri and TargetFile.scale-100.pri alongside TargetFile.pri under ParentFolder.

下面提供错误条件及相应的错误消息的示例。Here is an example error condition and the corresponding error message.

添加状态Error condition 错误消息Error message
输出文件名与配置中的其中一个资源包名称相同。The output file name is the same as one of the resource pack names in the configuration. 无效的配置:资源包名称 不能与输出文件 <outputfilename.pri> 相同。Invalid Configuration: Resource Pack name cannot be the same as the output file <outputfilename.pri>.

/ReverseMap(rm) 选项/ReverseMap(rm) option

你使用反向映射选项 (/rm) 与 newresourcepackversioned 一起生成 PRI 文件中的反向映射部分,可用于调试。You use the reverse map option (/rm) with new, resourcepack, and versioned to generate a reverse-mapping section in the PRI file, which can be used for debugging.

/SchemaFile(sf) 选项/SchemaFile(sf) option

你使用架构文件选项 (/sf) 与 newresourcepackversioned 一起在指定位置写入架构文件。You use the schema file option (/sf) with new, resourcepack, and versioned to write a schema file at the specified location.

对于 resourcepackversioned,你可以不提供 PRI 文件作为 /IndexFile(if) 的输入参数,而是提供架构文件。For resourcepack and versioned, instead of providing a PRI file as the input parameter for /IndexFile(if), you can instead provide a schema file.

/SchemaFile(sf) <FILEPATH>

FILEPATH 是指定写入架构文件的位置的标记。FILEPATH is a token that that specifies where to write the schema file.

这是架构文件的示例。This is an example of a schema file.

<PriInfo>
    <ResourceMap name="IndexName" resourceVersion="1.0"> 
        <ResourceMapSubtree name="Resources" index="1">
            <NamedResource name="String1" index="1"/>
            <NamedResource name="String2" index="1"/>
        </ResourceMapSubtree>
        <ResourceMapSubtree name="Files" index="2">
            <NamedResource name="logo.png" index="2"/>
            <ResourceMapSubtree name="images" index="3">
                <NamedResource name="success.png" index="3"/>
                <NamedResource name="error.png" index="3"/>
            </ResourceMapSubtree>
        </ResourceMapSubtree>
    </ResourceMap>
</PriInfo>

/VersionMajor(vma) 已弃用/VersionMajor(vma) is deprecated

主要版本 (/vma) 选项(适用于 new 命令)已弃用,使用它将引发此警告消息。The major version (/vma) option (for the new command) is deprecated, and using it results in this warning message.

'VersionMajor (vma)' input parameter has been deprecated. Please specify major version in the configuration file using 'majorVersion' attribute on 'resources' node.

若要提供主版本号,请使用 resources@majorVersion 配置文件中的属性。To provide the major version number, use the resources@majorVersion attribute in your configuration file.