共用方式為


MakePri.exe 命令列選項

MakePri.exe MakePri.exe 具有一組命令 createconfigdumpnewresourcepackversioned。 本主題詳述其使用的命令列選項。

注意

當您在檢查 Windows SDK for UWP Managed Apps 選項同時安裝 Windows 軟體發展工具組時,就會安裝 MakePri.exe。 其會安裝到 %WindowsSdkDir%bin\<WindowsTargetPlatformVersion>\x64\makepri.exe 路徑 (以及針對其他架構命名的資料夾中)。 例如: C:\Program Files (x86)\Windows Kits\10\bin\10.0.17713.0\x64\makepri.exe

從命令行取得協助

您可以執行 MakePri.exe helpMakePri.exe /? 查看可與 MakePri.exe 一起使用的命令。 您還可以發出 MakePri.exe <command> /? 來查看有關命令的詳細資訊,在極少數情況下,甚至 MakePri.exe <command> <option> 可以查看有關選項的詳細資訊。

MakePri 命令

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命令會建立新的初始化 PRI 設定檔,以定義您指定的限定詞預設值。 執行 MakePri.exe createconfig /? 以查看此命令的詳細說明。

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 命令會輸出傾印的 xml 檔案,其中包含指定 PRI 檔案中所有資源的清單。 執行 MakePri.exe dump /? 以查看此命令的詳細說明。

注意

無結構描述資源套件是使用 PRI 設定檔中的 omitSchemaFromResourcePacks 開關建立的資源套件。 若要傾印無結構描述的資源套件,請使用開關 /es <main_package_PRI_file>。 如果您不指定主檔案,那麼您將看到錯誤訊息「套件中的 resources.pri 已損壞,因此加密失敗 (錯誤 PRI222:0xdef0000f - 發生未指定的錯誤)」。

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 命令會透過依照設定檔的指示對專案中的檔案進行索引來建立新的 PRI 檔案。 執行 MakePri.exe new /? 以查看此命令的詳細說明。

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 命令會透過依照設定檔的指示對專案中的檔案進行索引來建立新的 PRI 檔案。 資源套件 PRI 檔案只包含現有 PRI 檔案中已指定之資源的其他變體。 執行 MakePri.exe resourcepack /? 以查看此命令的詳細說明。

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 命令會透過依照設定檔的指示對專案中的檔案進行索引來建立版本設定的 PRI 檔案。 執行 MakePri.exe versioned /? 以查看此命令的詳細說明。

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)

您可以將擴充 DLL 選項 (/ex) 與 createconfigdumpnewresourcepackversioned 一起使用來指定資源管理系統環境擴充 DLL 的位置。

記錄/中繼資料檔案

MakePri 可以包含索引子中繼資料檔案中資源套件的特定資訊。 以下是 resources.pri 的記錄檔範例,其中包含資源 PRI 檔案 german.prihighresolution.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) 選項

您可以使用索引檔案選項 (/if) 搭配 dumpresourcepackversioned 來指定輸入 PRI 檔案。

針對 resourcepackversioned,您可以改為提供結構描述檔案,而不是提供 PRI 檔案做為 /IndexFile 的輸入參數。

/IndexFile(if) <FILEPATH>

FILEPATH 是指定輸入 PRI 檔案或 PRI 結構描述檔案位置的權杖。

/IndexOptions(io) 選項

您可以使用索引選項選項 (/io) 搭配 newresourcepackversioned 來指定選項,以提供資源索引子行為的詳細控制項。 預設情況下,索引選項是停用的。

/IndexOptions(io) <OPTIONS>

OPTIONS 是由下列選項所組成的逗號分隔清單。

  • +/-HiddenFiles(hf)。 索引 (+) 或忽略 (-) 隱藏的檔案和資料夾。
  • +/-LinkedFiles(lf)。 索引 (+) 或忽略 (-) 連結的檔案和資料夾。

/MappingFile(mf) 選項

您可以將對應檔案選項 (/mf) 與 newresourcepackversioned 一起使用來產生對應檔案。 MakeAppx.exe 會使用對應檔案來產生應用程式套件。

/MappingFile(mf) <MAPPINGFILETYPE>

MAPPINGFILETYPE 是指定對應檔格式的權杖。 唯一有效的支援格式是 appx

/mf appx

這是主對應檔案的範例內容。

"ResourceDimensions"                   "language-de-de"

這是資源套件對應檔案的範例內容。

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

輸出摘要

如果建立資源套件,則來自 MakePRI.exe 的輸出摘要會是更詳細的表單。 以下是範例。

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) 選項

如果未提供覆寫選項 (/o),且指定的輸出檔案已存在,則 MakePri.exe 需要在覆寫之前進行確認。

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

/OutputFile(of) 選項

您可以將輸出檔案選項 (/of) 與 dumpnewresourcepackversioned 一起使用來指定要產生的 PRI 檔案的輸出位置和名稱。 如果 MakePri.exe 產生一個以上的資源 PRI 檔案,它會將它們放在目標檔案的父資料夾中。 例如,如果指定 /of MyParentFolder\TargetFile.pri,則 MakePri.exe 會在 ParentFolder 下產生 TargetFile.language-en.priTargetFile.scale-100.pri 以及 TargetFile.pri

以下是範例錯誤條件和對應的錯誤訊息。

錯誤狀況 錯誤訊息
輸出檔名與設定中的其中一個資源套件名稱相同。 無效的設定:資源套件名稱<資源套件名稱> 不能與輸出檔案 <outputfilename.pri> 相同。

/ReverseMap(rm) 選項

您可以將反向對應選項 (/rm) 與 newresourcepackversioned 一起使用,在 PRI 檔案中產生可用於偵錯的反向對應部分。

/SchemaFile(sf) 選項

您可以使用結構描述檔案選項 (/sf) 搭配 newresourcepackversioned,在指定的位置寫入結構描述檔案。

針對 resourcepackversioned,您可以改為提供結構描述檔案,而不是提供 PRI 檔案做為 /IndexFile 的輸入參數。

/SchemaFile(sf) <FILEPATH>

FILEPATH 是指定寫入結構描述檔案位置的權杖。

這是結構描述檔案的範例。

<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) 已被取代

主要版本 (/vma) 選項 (針對 new 命令) 已被取代,使用它會導致此警告訊息。

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

若要提供主要版本編號,請使用設定檔中的 resources@majorVersion 屬性。