共用方式為


UE-V 2.x [BOTH_UEVv2] 的應用程式範本結構描述參考

適用於: User Experience Virtualization 1.0, User Experience Virtualization 1.0 SP1, User Experience Virtualization 2.0, User Experience Virtualization 2.1

Microsoft User Experience Virtualization (UE-V) 2.0、2.1 和 2.1 SP1 使用 XML 設定位置範本,來定義 UE-V 擷取及套用的桌面應用程式設定和 Windows 設定。UE-V 包含一組預設設定位置範本。您也可以使用 UE-V 產生器建立自訂設定位置範本。

進階使用者可以自訂設定位置範本的 XML 檔案。本主題詳細說明 UE-V 2.1 (SP1) 和 2.0 設定位置範本的 XML 結構,並提供編輯這些檔案的指引。

UE-V 2.1 和 2.1 SP1 應用程式範本結構描述參考

本節詳細說明 UE-V 2.1 和 2.1 SP1 設定位置範本的 XML 結構,並提供編輯這個檔案的指引。

在本節中

  • XML 宣告和編碼屬性

  • 命名空間和根項目

  • 資料類型

  • Name 項目

  • ID 項目

  • Version 項目

  • Author 項目

  • Processes 和 Process 項目

  • Application 項目

  • Common 項目

  • SettingsLocationTemplate 項目

  • 附錄:SettingsLocationTemplate.xsd

XML 宣告和編碼屬性

強制:True

類型:字串

XML 宣告必須指定 XML 1.0 版屬性 (<?xml version="1.0">)。雖然未明確指定編碼方式,不過 UE-V 產生器所建立的設定位置範本會使用 UTF-8 編碼方式來儲存。建議您最好在這個項目中加入 encoding="UTF-8" 屬性。本產品隨附的所有範本也會指定這個標記 (如需參考,請參閱 %ProgramFiles%\Microsoft User Experience Virtualization\Templates 中的文件)。例如:

<?xml version="1.0" encoding="UTF-8"?>

命名空間和根項目

強制:True

類型:字串

UE-V 針對所有應用程式使用 https://schemas.microsoft.com/UserExperienceVirtualization/2012/SettingsLocationTemplate 命名空間。SettingsLocationTemplate 是根項目並包含所有其他項目。請使用下列標記參考所有範本中的 SettingsLocationTemplate:

<SettingsLocationTemplate xmlns='https://schemas.microsoft.com/UserExperienceVirtualization/2012/SettingsLocationTemplate'>

資料類型

以下是 UE-V 應用程式範本結構描述的資料類型。

  • GUID
    GUID 以下列格式來描述標準全域唯一識別碼規則運算式:"\{[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}\}"。這個資料類型可用於 Filesetting\Root\KnownFolder 項目中,以便確認已知資料夾的格式。
  • FilenameString
    FilenameString 表示要監視之處理序的檔案名稱。其值受到 regex [^\\\?\*\|<>/:]+ 的限制 (也就是說,這些值不能包含反斜線字元、星號或問號萬用字元、縱線字元、大於或小於符號、正斜線,或者冒號字元)。
  • IDString
    IDString 表示 Application、SettingsLocationTemplate 和 Common 項目 (用來描述共用通用設定的應用程式套件) 的 ID 值。這個值受到與 FilenameString ([^\\\?\*\|<>/:]+) 相同之 Regex 的限制。
  • TemplateVersion
    TemplateVersion 是用來描述設定位置範本修訂的整數值。其值的範圍從 0 到 2147483647。
  • Empty
    Empty 表示 null 值。這個資料類型可用於 Process\ShellProcess 中,表示沒有要監視的處理序。這個值不應該用於任何應用程式範本。
  • Author
    Author 資料類型是識別範本作者的複雜類型。它包含兩個子項目:NameEmail。在 Author 資料類型中,Name 項目為強制性,而 Email 項目為選擇性。SettingsLocationTemplate 項目下將更詳細地說明這個類型。
  • Range
    Range 定義由兩個子項目所組成的整數類別:MinimumMaximum。這個資料類型會在 ProcessVersion 資料類型中實作。如果指定,則必須同時包含 Minimum 和 Maximum 值。
  • ProcessVersion
    ProcessVersion 定義由四個子項目所組成的類型:MajorMinorBuildPatch。Process 項目使用這個資料類型來填入其 ProductVersion 和 FileVersion 值。這個類型的資料是 Range 值。Major 子項目為強制性,而其他項目則為選擇性。
  • 架構
    Architecture 列舉兩個可能值:Win32Win64。這些值可用來指定處理序架構。
  • Process
    Process 資料類型是用來描述 UE-V 所監視之處理序的容器。它包含六個子項目:FilenameArchitectureProductNameFileDescriptionProductVersionFileVersion。下表列出每個項目的相關資料類型:

    元素

    資料類型

    強制

    Filename

    FilenameString

    True

    架構

    架構

    False

    ProductName

    字串

    False

    FileDescription

    字串

    False

    ProductVersion

    ProcessVersion

    False

    FileVersion

    ProcessVersion

    False

  • Processes
    Processes 資料類型代表一個或多個 Process 項目集合的容器。Processes 序列類型支援兩個子項目:ProcessShellProcess。Process 是 Process 類型的項目,而 ShellProcess 屬於資料類型 Empty。序列中至少必須識別一個項目。
  • 路徑
    RegistrySetting 和 FileSetting 使用 Path 來參考登錄和檔案路徑。這個項目支援兩個選擇性屬性:RecursiveDeleteIfNotFound。這兩個值都會設定為 default=”False”。

    Recursive 指出在檔案設定中包含路徑和所有子資料,或在登錄設定中包含所有子登錄機碼。在這兩種情況下,目前層級的所有項目都會包含在所擷取的資料中。若是 FileSettings 物件,指定資料夾中的所有檔案都會都包含在 UE-V 所擷取的資料中,但不會包含資料夾。若是登錄路徑,則會擷取目前路徑中的所有值,但不會擷取子登錄機碼。在這兩種情況下,應該小心避免擷取大型資料集或大量項目。

    DeleteIfNotFound 屬性會從使用者的設定儲存路徑資料移除設定。如果從套件移除這些設定能省下設定儲存路徑檔案伺服器上的大量磁碟空間,則可能適合使用這個屬性。

  • FileMask
    FileMask 只能指定 Path 所定義之資料夾的特定檔案類型。例如,Path 可以是 C:\users\username\files,而 FileMask 可以是只包含文字檔的 *.txt
  • RegistrySetting
    RegistrySetting 代表與 UE-V 代理程式組件的所需行為關聯之登錄機碼和值的容器。在這個類型中會定義四個子項目:PathNameExclude,以及一連串的 PathName 值。
  • FileSetting
    FileSetting 包含與檔案和檔案路徑關聯的參數。其定義四個子項目:RootPathFileMaskExclude。Root 為強制性,而其他項目則為選擇性。
  • Settings
    Settings 是套用至特定範本之所有設定的容器。它包含上述 Registry、File、SystemParameter 和 CustomAction 設定的執行個體。此外,也可包含下列子項目,其行為描述如下:

    元素

    說明

    Asynchronous

    Asynchronous 設定套件可在不封鎖應用程式啟動的情況下套用,以便應用程式於設定仍在套用時繼續啟動。適用於可非同步套用的設定,例如透過 SystemParameterSetting 等 API 套用 get/set

    PreventOverlappingSynchronization

    根據預設,UE-V 只會在關閉使用範本的最後一個應用程式執行個體時,才會儲存應用程式的設定。當這個項目設定為 'false' 時,即使有其他應用程式執行個體正在執行,UE-V 也可以匯出設定。UE-V 隨附的適用範本 (包括 Common 項目區段的範本) 使用這個旗標來啟用共用設定,以便在應用程式關閉時一律匯出,同時避免在最後一個執行個體關閉之前匯出應用程式特定的設定。

    AlwaysApplySettings

    (在 2.1 中引入)

    這個參數會強制套用匯入的設定套件,即使該套件和應用程式的目前狀態之間沒有差異亦然。由於這個參數可能會使設定匯入變慢,因此只有在特殊情況下才應該使用。

Name 項目

強制:True

類型:字串

Name 可指定設定位置範本的唯一名稱。可在參考 WMI、PowerShell、事件檢視器和偵錯記錄中的範本時,用來顯示範本。一般而言,請避免參考版本資訊,因為這項資訊可從 ProductVersion 項目中取得。例如,指定 <Name>My Application</Name>,而不是 <Name>My Application 1.1</Name>

注意

UE-V 不會參考外部 DTD,因此無法在設定位置範本中使用具名實體。例如,請勿使用 &reg; 來參考註冊商標符號 ®。請改用標準編號參考來加入這些類型的特殊字元,例如以 &#174 表示 ® 字元。這項規則適用於本文件中的所有字串值。

如需字元實體的完整清單,請參閱 http://www.w3.org/TR/xhtml1/dtds.html。以 UTF 8 編碼的文件可直接包含 Unicode 字元。透過 UE-V 產生器儲存範本會自動將字元實體轉換成其 Unicode 表示。

ID 項目

強制:True

類型:字串

ID 可填入特定範本的唯一識別碼。這個標記會變成 UE-V 代理程式在執行階段用來參考範本的主要識別碼 (例如,請參閱 Get-UevTemplate 和 Get-UevTemplateProgram PowerShell Cmdlet 的輸出)。依照慣例,這個標記不應該包含任何空格,因此可簡化指令碼。您應該在這個項目中指定應用程式的版本號碼,以便識別範本,例如 <ID>MicrosoftCalculator6</ID><ID>MicrosoftOffice2010Win64</ID>

Version 項目

強制:True

類型:整數

最小值:0

最大值:2147483647

Version 可識別設定位置範本的版本,以便進行變更的管理追蹤。UE-V 產生器會在每次儲存範本時,自動將這個數值加上 1。請注意,這個欄位必須是正整數;不允許使用 <Version>2.5</Version> 等小數值。

**提示:**您可以使用 XML 註解標記 <!-- -->,來儲存版本變更的相關註解,例如:

  <!--
     Version History

     Version 1 Jul 05, 2012 Initial template created by Generator - Denise@Contoso.com
     Version 2 Jul 31, 2012 Added support for app.exe v2.1.3 - Mark@Contoso.com
     Version 3 Jan 01, 2013 Added font settings support - Mark@Contoso.com
     Version 4 Jan 31, 2013 Added support for plugin settings - Tony@Contoso.com
   -->
  <Version>4</Version>

重要

在下列情況下,系統會查詢這個值以判斷是否應該將新版範本套用至現有範本:

  • 排程的範本自動更新工作執行時

  • 執行 Update-UevTemplate PowerShell Cmdlet 時

  • 透過 WMI 呼叫 microsoft\uev:SettingsLocationTemplate Update 方法時

Author 項目

強制:False

類型:字串

Author 可識別設定位置範本的建立者。其支援兩個選擇性子項目:NameEmail。這兩個屬性是選擇性,但如果指定 Email 子項目,也必須指定 Name 項目。Author 表示設定位置範本之連絡人的全名,而 Email 則應該表示作者的電子郵件地址。建議您在公開發行的範本中包含這項資訊;例如,在 UE-V 範本庫中。

Processes 和 Process 項目

強制:True

類型:元素

Processes 至少包含一個 <Process> 項目,後者又包含下列子項目:FilenameArchitectureProductNameFileDescriptionProductVersionFileVersion。Filename 子項目為強制性,而其他項目則為選擇性。完整填入的項目包含類似下列範例中的標記:

    <Process>
      <Filename>MyApplication.exe</Filename>
      <Architecture>Win64</Architecture>
      <ProductName> MyApplication </ProductName>
      <FileDescription>MyApplication.exe</FileDescription>
      <ProductVersion>
        <Major Minimum="2" Maximum="2" />
        <Minor Minimum="0" Maximum="0" />
        <Build Minimum="0" Maximum="0" />
        <Patch Minimum="5" Maximum="5" />
      </ProductVersion>
      <FileVersion>
        <Major Minimum="2" Maximum="2" />
        <Minor Minimum="0" Maximum="0" />
        <Build Minimum="0" Maximum="0" />
        <Patch Minimum="5" Maximum="5" />
      </FileVersion>
    </Process>

Filename

強制:True

類型:字串

Filename 表示可執行檔在檔案系統中所顯示的實際檔案名稱。這個項目可指定 UE-V 用來評估是否將範本套用至處理序的主要準則。您必須在設定位置範本 XML 中指定這個項目。

有效的檔案名稱不能符合規則運算式 [^\\\?\*\|<>/:]+;也就是說,檔案名稱不能包含反斜線字元、星號或問號萬用字元、縱線字元、大於或小於符號、正斜線,或者冒號 (\ ?* | < > / 或 :字元)。

提示:若要對這個 Regex 測試字串,請使用 PowerShell 命令視窗,並以您的檔案名稱替代可執行檔的名稱:

"YourFileName.exe" -match "[\\\?\*\|<>/:]+"

True 表示這個字串包含無效的字元。以下是無效值的一些範例:

  • \\server\share\program.exe

  • Program*.exe

  • Pro?ram.exe

  • Program<1>.exe

注意

UE-V 產生器會將大於和小於字元分別編碼為 &gt; 和 &lt;。

在罕見的情況下,FileName 值不一定會包含 .exe 副檔名,但它應該指定為值的一部分。例如,您應該指定 <Filename>MyApplictication.exe</Filename>,而不是 <Filename>MyApplictication</Filename>。如果可執行檔的實際名稱為 "MyApplication.exe",第二個範例不會將範本套用至處理序。

架構

強制:False

類型:架構 (字串)

Architecture 表示已編譯目標可執行檔的處理器架構。有效值包括代表 32 位元應用程式的 Win32,或代表 64 位元應用程式的 Win64。如果存在,這個標記會將設定位置範本的適用性限制為特定應用程式架構。例如,比較 UE-V 隨附的 %ProgramFiles%\Microsoft User Experience Virtualization\templates\ MicrosoftOffice2010Win32.xml 和 MicrosoftOffice2010Win64.xml 檔案。當可執行檔的不同版本之間的相對路徑變更時,或者如果從某個處理器架構移至另一個處理器架構時已加入或移除設定,這個項目可能會很有用。

如果這個項目不存在,設定位置範本會忽略該處理序的架構,並在檔案名稱和其他屬性適用時,同時套用至 32 和 64 位元處理序。

注意

UE-V 在這個版本中不支援 ARM 處理器。

ProductName

強制:False

類型:字串

ProductName 是可用來識別產品以便進行管理或報告的選擇性項目。ProductName 與 Filename 不同,其值不受規則運算式的限制。這可讓您在可執行檔名稱不是那麼明顯時,更容易了解處理序的描述。例如:

    <Process>
      <Filename>MyApplication.exe</Filename>
      <ProductName>My Application 6.x by Contoso.com</ProductName>
      <ProductVersion>
        <Major Minimum="6" Maximum="6" />
      </ProductVersion>
    </Process>

FileDescription

強制:False

類型:字串

FileDescription 是允許可執行檔管理性描述的選擇性標記。這是任意文字欄位,可在需要識別可執行檔的功能時,用來區別軟體套件中的多個可執行檔。

例如,在適用的應用程式中,提供有關兩個可執行檔 (MyApplication.exe 和 MyApplicationHelper.exe) 功能的提醒,可能會很有用 (如下所示):

<Processes>
 
   <Process>
      <Filename>MyApplication.exe</Filename>
      <FileDescription>My Application Main Engine</ FileDescription>
      <ProductVersion>
        <Major Minimum="6" Maximum="6" />
      </ProductVersion>
    </Process>
    <Process>
      <Filename>MyApplicationHelper.exe</Filename>
      <FileDescription>My Application Background Process Executable</FileDescription>
      <ProductVersion>
        <Major Minimum="6" Maximum="6" />
      </ProductVersion>
    </Process>
</Processes>

ProductVersion

強制:False

類型:字串

ProductVersion 表示檔案的主要和次要產品版本,以及組建和修補程式等級。ProductVersion 是選擇性項目,但如果指定,則至少必須包含 Major 子項目。其值必須以 Minimum="X" Maximum="Y" 格式表示範圍,其中 X 和 Y 是整數。Minimum 和 Maximum 值可以相同。

產品和檔案版本項目可能會保留未設定。這樣做可讓範本「無從驗證版本」,亦即範本會套用至指定可執行檔的所有版本。

範例 1:

產品版本:1.0 (指定於 UE-V 產生器中) 會產生下列 XML:

      <ProductVersion>
        <Major Minimum="1" Maximum="1" />
        <Minor Minimum="0" Maximum="0" />
      </ProductVersion>

範例 2:

檔案版本:5.0.2.1000 (指定於 UE-V 產生器中) 會產生下列 XML:

      <FileVersion>
        <Major Minimum="5" Maximum="5" />
        <Minor Minimum="0" Maximum="0" />
        <Build Minimum="2" Maximum="2" />
        <Patch Minimum="1000" Maximum="1000" />
      </FileVersion>

不正確的範例 1 - 不完整的範圍:

只有 Minimum 屬性。範圍中必須也包含 Maximum。

      <ProductVersion>
        <Major Minimum="2" />
      </ProductVersion>

不正確的範例 2 - 已指定 Minor 但沒有 Major 項目:

只有 Minor 項目。必須也包含 Major。

      <ProductVersion>
        <Minor Minimum="0" Maximum="0" />
      </ProductVersion>

FileVersion

強制:False

類型:字串

FileVersion 可區別已發行應用程式的發行版本,以及元件可執行檔的內部組建詳細資料。對於大多數商業應用程式而言,這些數值是相同的。在兩者不同的情況下,檔案的產品版本表示檔案的一般版本識別碼,而檔案版本則表示檔案的特定組建 (例如 Hotfix 或更新)。如此可唯一識別檔案,而不會中斷偵測邏輯。

若要判斷特定可執行檔的產品版本和檔案版本,請以滑鼠右鍵按一下 Windows 檔案總管中的檔案,選取 [內容],然後按一下 [詳細資料] 索引標籤。

包括應用程式的 FileVersion 項目可更細微地微調偵測邏輯,但這對大多數應用程式而言絕非必要。系統會先檢查 ProductVersion 項目設定,再檢查 FileVersion;然後套用較嚴格的設定。

FileVersion 的子項目和語法規則與 ProductVersion 相同。

      <Process>
        <Filename>MSACCESS.EXE</Filename>
        <Architecture>Win32</Architecture>
        <ProductVersion>
          <Major Minimum="14" Maximum="14" />
          <Minor Minimum="0" Maximum="0" />
        </ProductVersion>
        <FileVersion>
          <Major Minimum="14" Maximum="14" />
          <Minor Minimum="0" Maximum="0" />
        </FileVersion>
      </Process>

Application 項目

Application 是套用至特定應用程式之設定的容器。它是下列欄位/類型的集合。

欄位/類型

說明

名稱

指定設定位置範本的唯一名稱。可在參考 WMI、PowerShell、事件檢視器和偵錯記錄中的範本時,用來顯示範本。如需詳細資訊,請參閱Name 項目。

ID

填入特定範本的唯一識別碼。這個標記會變成 UE-V 代理程式在執行階段用來參考範本的主要識別碼。如需詳細資訊,請參閱ID 項目。

說明

範本的選擇性描述。

LocalizedNames

在 UI 中顯示的選擇性名稱,已依語言地區設定當地語系化。

LocalizedDescriptions

依語言地區設定當地語系化的選擇性範本描述。

版本

識別設定位置範本的版本,以便進行變更的管理追蹤。如需詳細資訊,請參閱Version 項目。

DeferToMSAccount

控制是否要搭配 Microsoft 帳戶啟用這個範本。如果針對使用者或在電腦上啟用 MSA 同步處理,則會自動停用這個範本。

DeferToOffice365

類似於 MSA,這個欄位可控制是否要搭配 Office365 啟用這個範本。如果正在使用 Office 365 同步處理設定,則會自動停用這個範本。

FixedProfile (在 2.1 中引進)

指定這個範本只能與這個項目中指定的設定檔關聯,且無法透過 WMI 或 PowerShell 變更。

Processes

一個或多個 Process 項目集合的容器。如需詳細資訊,請參閱Processes 和 Process 項目。

Settings

套用至特定範本之所有設定的容器。它包含 Registry、File、SystemParameter 和 CustomAction 設定的執行個體。如需詳細資訊,請參閱資料類型中的 Settings

Common 項目

Common 類似於 Application 項目,但一律會與兩個或多個 Application 項目關聯。Common 區段代表可在這些 Application 執行個體之間共用的一組設定。它是下列欄位/類型的集合。

欄位/類型

說明

名稱

指定設定位置範本的唯一名稱。可在參考 WMI、PowerShell、事件檢視器和偵錯記錄中的範本時,用來顯示範本。如需詳細資訊,請參閱Name 項目。

ID

填入特定範本的唯一識別碼。這個標記會變成 UE-V 代理程式在執行階段用來參考範本的主要識別碼。如需詳細資訊,請參閱ID 項目。

說明

範本的選擇性描述。

LocalizedNames

在 UI 中顯示的選擇性名稱,已依語言地區設定當地語系化。

LocalizedDescriptions

依語言地區設定當地語系化的選擇性範本描述。

版本

識別設定位置範本的版本,以便進行變更的管理追蹤。如需詳細資訊,請參閱Version 項目。

DeferToMSAccount

控制是否要搭配 Microsoft 帳戶啟用這個範本。如果針對使用者或在電腦上啟用 MSA 同步處理,則會自動停用這個範本。

DeferToOffice365

類似於 MSA,這個欄位可控制是否要搭配 Office365 啟用這個範本。如果正在使用 Office 365 同步處理設定,則會自動停用這個範本。

FixedProfile (在 2.1 中引進)

指定這個範本只能與這個項目中指定的設定檔關聯,且無法透過 WMI 或 PowerShell 變更。

Settings

套用至特定範本之所有設定的容器。它包含 Registry、File、SystemParameter 和 CustomAction 設定的執行個體。如需詳細資訊,請參閱資料類型中的 Settings

SettingsLocationTemplate 項目

這個項目可定義單一應用程式或一組應用程式的設定。

欄位/類型

說明

名稱

指定設定位置範本的唯一名稱。可在參考 WMI、PowerShell、事件檢視器和偵錯記錄中的範本時,用來顯示範本。如需詳細資訊,請參閱Name 項目。

ID

填入特定範本的唯一識別碼。這個標記會變成 UE-V 代理程式在執行階段用來參考範本的主要識別碼。如需詳細資訊,請參閱ID 項目。

說明

範本的選擇性描述。

LocalizedNames

在 UI 中顯示的選擇性名稱,已依語言地區設定當地語系化。

LocalizedDescriptions

依語言地區設定當地語系化的選擇性範本描述。

附錄:SettingsLocationTemplate.xsd

下列 SettingsLocationTemplate.xsd 檔案顯示其項目、子項目、屬性和參數:

<?xml version="1.0" encoding="utf-8"?>
<xs:schema id="UevSettingsLocationTemplate"
  targetNamespace="https://schemas.microsoft.com/UserExperienceVirtualization/2013A/SettingsLocationTemplate"
  elementFormDefault="qualified"
  xmlns="https://schemas.microsoft.com/UserExperienceVirtualization/2013A/SettingsLocationTemplate"
  xmlns:mstns="https://schemas.microsoft.com/UserExperienceVirtualization/2013A/SettingsLocationTemplate"
  xmlns:xs="http://www.w3.org/2001/XMLSchema">

    <xs:simpleType name="Guid">
        <xs:restriction base="xs:string">
            <xs:pattern value="\{[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}\}" />
        </xs:restriction>
    </xs:simpleType>

    <xs:simpleType name="FilenameString">
        <xs:restriction base="xs:string">
            <xs:pattern value="[^\\\?\*\|&lt;&gt;/:]+" />
        </xs:restriction>
    </xs:simpleType>

    <xs:simpleType name="IDString">
        <xs:restriction base="xs:string">
            <xs:pattern value="[^\\\?\*\|&lt;&gt;/:.]+" />
        </xs:restriction>
    </xs:simpleType>

    <xs:simpleType name="CompositeIDString">
        <xs:restriction base="xs:string">
            <xs:pattern value="[^\\\?\*\|&lt;&gt;/:.]+([.][^\\\?\*\|&lt;&gt;/:.]+)?" />
        </xs:restriction>
    </xs:simpleType>
  
    <xs:simpleType name="TemplateVersion">
        <xs:restriction base="xs:integer">
            <xs:minInclusive value="0" />
            <xs:maxInclusive value="2147483647" />
        </xs:restriction>
    </xs:simpleType>

    <xs:complexType name="Empty">
        <xs:sequence/>
    </xs:complexType>

    <xs:complexType name="LocalizedString">
        <xs:simpleContent>
            <xs:extension base="xs:string">
                <xs:attribute name="Locale" type="xs:string" use="required"/>
            </xs:extension>
        </xs:simpleContent>
    </xs:complexType>

    <xs:complexType name="LocalizedName">
        <xs:sequence>
            <xs:element name="Name" type="LocalizedString" minOccurs="1" maxOccurs="unbounded" />
        </xs:sequence>
    </xs:complexType>

    <xs:complexType name="LocalizedDescription">
        <xs:sequence>
            <xs:element name="Description" type="LocalizedString" minOccurs="1" maxOccurs="unbounded" />
        </xs:sequence>
    </xs:complexType>

    <xs:complexType name="ReplacedTemplates">
      <xs:sequence>
        <xs:element name="ID" type="CompositeIDString" minOccurs="1" maxOccurs="unbounded" />
    </xs:sequence>
    </xs:complexType>
  
    <xs:complexType name="Author">
        <xs:all>
            <xs:element name="Name" type="xs:string" minOccurs="1" />
            <xs:element name="Email" type="xs:string" minOccurs="0" />
        </xs:all>
    </xs:complexType>

    <xs:complexType name="Range">
        <xs:attribute name="Minimum" type="xs:integer" use="required"/>
        <xs:attribute name="Maximum" type="xs:integer" use="required"/>
    </xs:complexType>

    <xs:complexType name="ProcessVersion">
        <xs:sequence>
            <xs:element name="Major" type="Range" minOccurs="1" />
            <xs:element name="Minor" type="Range" minOccurs="0" />
            <xs:element name="Build" type="Range" minOccurs="0" />
            <xs:element name="Patch" type="Range" minOccurs="0" />
        </xs:sequence>
    </xs:complexType>

    <xs:simpleType name="Architecture">
        <xs:restriction base="xs:string">
            <xs:enumeration value="Win32"/>
            <xs:enumeration value="Win64"/>
        </xs:restriction>
    </xs:simpleType>

    <xs:complexType name="Process">
        <xs:sequence>
            <xs:element name="Filename" type="FilenameString" minOccurs="1" />
            <xs:element name="Architecture" type="Architecture" minOccurs="0" />
            <xs:element name="ProductName" type="xs:string" minOccurs="0" />
            <xs:element name="FileDescription" type="xs:string" minOccurs="0" />
            <xs:element name="ProductVersion" type="ProcessVersion" minOccurs="0" maxOccurs="unbounded"/>
            <xs:element name="FileVersion" type="ProcessVersion" minOccurs="0" maxOccurs="unbounded"/>
        </xs:sequence>
    </xs:complexType>

    <xs:complexType name="Processes">
        <xs:sequence>
            <xs:choice minOccurs="1">
                <xs:element name="Process" type="Process" />
                <xs:element name="ShellProcess" type="Empty" />
            </xs:choice>
            <xs:element name="Process" type="Process" minOccurs="0" maxOccurs="unbounded" />
        </xs:sequence>
    </xs:complexType>

    <xs:complexType name="Path">
        <xs:simpleContent>
            <xs:extension base="xs:string">
                <xs:attribute name="Recursive" type="xs:boolean" default="false"/>
                <xs:attribute name="DeleteIfNotFound" type="xs:boolean" default="false"/>
            </xs:extension>
        </xs:simpleContent>
    </xs:complexType>

    <xs:complexType name="RegistrySetting">
        <xs:sequence>
            <xs:element name="Path" type="Path" />
            <xs:element name="Name" type="xs:string" minOccurs="0" maxOccurs="unbounded" />
            <xs:element name="Exclude" minOccurs="0" maxOccurs="unbounded">
                <xs:complexType>
                    <xs:sequence>
                        <xs:element name="Path" type="Path" minOccurs="0" />
                        <xs:element name="Name" type="xs:string" minOccurs="0" maxOccurs="unbounded" />
                    </xs:sequence>
                </xs:complexType>
            </xs:element>
        </xs:sequence>
    </xs:complexType>

    <xs:complexType name="FileSetting">
        <xs:sequence>

            <xs:element name="Root">
                <xs:complexType>
                    <xs:choice>
                        <xs:element name="KnownFolder" type="Guid" />
                        <xs:element name="RegistryEntry" type="xs:string" />
                        <xs:element name="EnvironmentVariable" type="xs:string" />
                    </xs:choice>
                </xs:complexType>
            </xs:element>

            <xs:element name="Path" minOccurs="0" type="Path" />
            <xs:element name="FileMask" type="xs:string" minOccurs="0" maxOccurs="unbounded"/>

            <xs:element name="Exclude" minOccurs="0" maxOccurs="unbounded">
                <xs:complexType>
                    <xs:sequence>
                        <xs:element name="Path" type="Path" minOccurs="0" />
                        <xs:element name="FileMask" type="xs:string" minOccurs="0" maxOccurs="unbounded" />
                    </xs:sequence>
                </xs:complexType>
            </xs:element>

        </xs:sequence>
    </xs:complexType>

    <xs:simpleType name="CustomActionSetting">
        <xs:restriction base="xs:anyURI"/>
    </xs:simpleType>

    <xs:simpleType name="SystemParameterSetting">
        <xs:restriction base="xs:string">

            <!-- Accessibility parameters -->
            <xs:enumeration value="AccessTimeout"/>
            <xs:enumeration value="AudioDescription"/>
            <xs:enumeration value="ClientAreaAnimation"/>
            <xs:enumeration value="DisableOverlappedContent"/>
            <xs:enumeration value="FilterKeys"/>
            <xs:enumeration value="FocusBorderHeight"/>
            <xs:enumeration value="FocusBorderWidth"/>
            <xs:enumeration value="HighContrast"/>
            <xs:enumeration value="MessageDuration"/>
            <xs:enumeration value="MouseClickLock"/>
            <xs:enumeration value="MouseClickLockTime"/>
            <xs:enumeration value="MouseKeys"/>
            <xs:enumeration value="MouseSonar"/>
            <xs:enumeration value="MouseVanish"/>
            <xs:enumeration value="ScreenReader"/>
            <xs:enumeration value="ShowSounds"/>
            <xs:enumeration value="SoundSentry"/>
            <xs:enumeration value="StickyKeys"/>
            <xs:enumeration value="ToggleKeys"/>

            <!-- Input parameters -->
            <xs:enumeration value="Beep"/>
            <xs:enumeration value="BlockSendInputResets"/>
            <xs:enumeration value="DefaultInputLang"/>
            <xs:enumeration value="DoubleClickTime"/>
            <xs:enumeration value="DoubleClkHeight"/>
            <xs:enumeration value="DoubleClkWidth"/>
            <xs:enumeration value="KeyboardCues"/>
            <xs:enumeration value="KeyboardDelay"/>
            <xs:enumeration value="KeyboardPref"/>
            <xs:enumeration value="KeyboardSpeed"/>
            <xs:enumeration value="Mouse"/>
            <xs:enumeration value="MouseButtonSwap"/>
            <xs:enumeration value="MouseHoverHeight"/>
            <xs:enumeration value="MouseHoverTime"/>
            <xs:enumeration value="MouseHoverWidth"/>
            <xs:enumeration value="MouseSpeed"/>
            <xs:enumeration value="MouseTrails"/>
            <xs:enumeration value="SnapToDefButton"/>
            <xs:enumeration value="WheelScrollChars"/>
            <xs:enumeration value="WheelScrollLines"/>

            <!-- Desktop parameters (limited subset) -->
            <xs:enumeration value="DeskWallpaper"/>
            <xs:enumeration value="DesktopColor"/>

        </xs:restriction>
    </xs:simpleType>

    <xs:complexType name="Settings">
        <xs:sequence>
            <xs:element name="Asynchronous" type="xs:boolean" minOccurs="0" />
            <xs:element name="PreventOverlappingSynchronization" type="xs:boolean" minOccurs="0" />
            <xs:element name="AlwaysApplySettings" type="xs:boolean" minOccurs="0" />
            <xs:choice minOccurs="0" maxOccurs="unbounded">
                <xs:element name="Registry" type="RegistrySetting" />
                <xs:element name="File" type="FileSetting" />
                <xs:element name="SystemParameter" type="SystemParameterSetting" />
                <xs:element name="CustomAction" type="CustomActionSetting" />
            </xs:choice>
        </xs:sequence>
    </xs:complexType>

    <xs:complexType name="Common">
        <xs:sequence>
            <xs:element name="Name" type="xs:string" />
            <xs:element name="ID" type="IDString" />
            <xs:element name="ReplacedTemplates" type="ReplacedTemplates" minOccurs="0" />
            <xs:element name="Description" type="xs:string" minOccurs="0" />
            <xs:element name="LocalizedNames" type="LocalizedName" minOccurs="0" />
            <xs:element name="LocalizedDescriptions" type="LocalizedDescription" minOccurs="0" />
            <xs:element name="Version" type="xs:integer" />
            <xs:element name="DeferToMSAccount" type="Empty"  minOccurs="0" />
            <xs:element name="DeferToOffice365" type="Empty" minOccurs="0" />
            <xs:element name="Settings" type="Settings" />
        </xs:sequence>
    </xs:complexType>

    <xs:complexType name="Application">
        <xs:sequence>
            <xs:element name="Name" type="xs:string" />
            <xs:element name="ID" type="IDString" />
            <xs:element name="ReplacedTemplates" type="ReplacedTemplates" minOccurs="0" />
            <xs:element name="Description" type="xs:string" minOccurs="0" />
            <xs:element name="LocalizedNames" type="LocalizedName" minOccurs="0" />
            <xs:element name="LocalizedDescriptions" type="LocalizedDescription" minOccurs="0" />
            <xs:element name="Version" type="xs:integer" />
            <xs:element name="DeferToMSAccount" type="Empty"  minOccurs="0" />
            <xs:element name="DeferToOffice365" type="Empty" minOccurs="0" />
            <xs:element name="Processes" type="Processes" />
            <xs:element name="Settings" type="Settings" />
        </xs:sequence>
    </xs:complexType>


    <xs:element name="SettingsLocationTemplate">
        <xs:complexType>
            <xs:sequence>

                <xs:element name="Name" type="xs:string" />
                <xs:element name="ID" type="IDString" />
                <xs:element name="Description" type="xs:string" minOccurs="0" />
                <xs:element name="LocalizedNames" type="LocalizedName" minOccurs="0" />
                <xs:element name="LocalizedDescriptions" type="LocalizedDescription" minOccurs="0" />

                <xs:choice>

                    <!-- Single application -->
                    <xs:sequence>
                        <xs:element name="ReplacedTemplates" type="ReplacedTemplates" minOccurs="0" />
                        <xs:element name="Version" type="TemplateVersion" />
                        <xs:element name="Author" type="Author" minOccurs="0" />
                        <xs:element name="FixedProfile" type="xs:string"  minOccurs="0" />
                        <xs:element name="DeferToMSAccount" type="Empty"  minOccurs="0" />
                        <xs:element name="DeferToOffice365" type="Empty" minOccurs="0" />
                        <xs:element name="Processes" type="Processes" />
                        <xs:element name="Settings" type="Settings" />
                    </xs:sequence>

                    <!-- Suite of applications -->
                    <xs:sequence>
                        <xs:element name="ManageSuiteOnly" type="xs:boolean" minOccurs="0" />
                        <xs:element name="Author" type="Author" minOccurs="0" />
                        <xs:element name="FixedProfile" type="xs:string"  minOccurs="0" />
                        <xs:element name="Common" type="Common" />
                        <xs:element name="Application" type="Application" minOccurs="2" maxOccurs="unbounded" />
                    </xs:sequence>

                </xs:choice>

            </xs:sequence>
        </xs:complexType>
    </xs:element>
    <!-- SettingsLocationTemplate -->

</xs:schema>

UE-V 2.0 應用程式範本結構描述參考

本節詳細說明 UE-V 2.0 設定位置範本的 XML 結構,並提供編輯這個檔案的指引。

在本節中

  • XML 宣告和編碼屬性

  • 命名空間和根項目

  • 資料類型

  • Name 項目

  • ID 項目

  • Version 項目

  • Author 項目

  • Processes 和 Process 項目

  • Application 項目

  • Common 項目

  • SettingsLocationTemplate 項目

  • 附錄:SettingsLocationTemplate.xsd

XML 宣告和編碼屬性

強制:True

類型:字串

XML 宣告必須指定 XML 1.0 版屬性 (<?xml version="1.0">)。雖然未明確指定編碼方式,不過 UE-V 產生器所建立的設定位置範本會使用 UTF-8 編碼方式來儲存。建議您最好在這個項目中加入 encoding="UTF-8" 屬性。本產品隨附的所有範本也會指定這個標記 (如需參考,請參閱 %ProgramFiles%\Microsoft User Experience Virtualization\Templates 中的文件)。例如:

<?xml version="1.0" encoding="UTF-8"?>

命名空間和根項目

強制:True

類型:字串

UE-V 針對所有應用程式使用 https://schemas.microsoft.com/UserExperienceVirtualization/2012/SettingsLocationTemplate 命名空間。SettingsLocationTemplate 是根項目並包含所有其他項目。請使用下列標記參考所有範本中的 SettingsLocationTemplate:

<SettingsLocationTemplate xmlns='https://schemas.microsoft.com/UserExperienceVirtualization/2012/SettingsLocationTemplate'>

資料類型

以下是 UE-V 應用程式範本結構描述的資料類型。

  • GUID
    GUID 以下列格式來描述標準全域唯一識別碼規則運算式:"\{[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}\}"。這個資料類型可用於 Filesetting\Root\KnownFolder 項目中,以便確認已知資料夾的格式。
  • FilenameString
    FilenameString 表示要監視之處理序的檔案名稱。其值受到 regex [^\\\?\*\|<>/:]+ 的限制 (也就是說,這些值不能包含反斜線字元、星號或問號萬用字元、縱線字元、大於或小於符號、正斜線,或者冒號字元)。
  • IDString
    IDString 表示 Application、SettingsLocationTemplate 和 Common 項目 (用來描述共用通用設定的應用程式套件) 的 ID 值。這個值受到與 FilenameString ([^\\\?\*\|<>/:]+) 相同之 Regex 的限制。
  • TemplateVersion
    TemplateVersion 是用來描述設定位置範本修訂的整數值。其值的範圍從 0 到 2147483647。
  • Empty
    Empty 表示 null 值。這個資料類型可用於 Process\ShellProcess 中,表示沒有要監視的處理序。這個值不應該用於任何應用程式範本。
  • Author
    Author 資料類型是識別範本作者的複雜類型。它包含兩個子項目:NameEmail。在 Author 資料類型中,Name 項目為強制性,而 Email 項目為選擇性。SettingsLocationTemplate 項目下將更詳細地說明這個類型。
  • Range
    Range 定義由兩個子項目所組成的整數類別:MinimumMaximum。這個資料類型會在 ProcessVersion 資料類型中實作。如果指定,則必須同時包含 Minimum 和 Maximum 值。
  • ProcessVersion
    ProcessVersion 定義由四個子項目所組成的類型:MajorMinorBuildPatch。Process 項目使用這個資料類型來填入其 ProductVersion 和 FileVersion 值。這個類型的資料是 Range 值。Major 子項目為強制性,而其他項目則為選擇性。
  • 架構
    Architecture 列舉兩個可能值:Win32Win64。這些值可用來指定處理序架構。
  • Process
    Process 資料類型是用來描述 UE-V 所監視之處理序的容器。它包含六個子項目:FilenameArchitectureProductNameFileDescriptionProductVersionFileVersion。下表列出每個項目的相關資料類型:

    元素 資料類型 強制

    Filename

    FilenameString

    True

    架構

    架構

    False

    ProductName

    字串

    False

    FileDescription

    字串

    False

    ProductVersion

    ProcessVersion

    False

    FileVersion

    ProcessVersion

    False

  • Processes
    Processes 資料類型代表一個或多個 Process 項目集合的容器。Processes 序列類型支援兩個子項目:ProcessShellProcess。Process 是 Process 類型的項目,而 ShellProcess 屬於資料類型 Empty。序列中至少必須識別一個項目。
  • 路徑
    RegistrySetting 和 FileSetting 使用 Path 來參考登錄和檔案路徑。這個項目支援兩個選擇性屬性:RecursiveDeleteIfNotFound。這兩個值都會設定為 default=”False”。

    Recursive 指出在檔案設定中包含路徑和所有子資料,或在登錄設定中包含所有子登錄機碼。在這兩種情況下,目前層級的所有項目都會包含在所擷取的資料中。若是 FileSettings 物件,指定資料夾中的所有檔案都會都包含在 UE-V 所擷取的資料中,但不會包含資料夾。若是登錄路徑,則會擷取目前路徑中的所有值,但不會擷取子登錄機碼。在這兩種情況下,應該小心避免擷取大型資料集或大量項目。

    DeleteIfNotFound 屬性會從使用者的設定儲存路徑資料移除設定。如果從套件移除這些設定能省下設定儲存路徑檔案伺服器上的大量磁碟空間,則可能適合使用這個屬性。

  • FileMask
    FileMask 只能指定 Path 所定義之資料夾的特定檔案類型。例如,Path 可以是 C:\users\username\files,而 FileMask 可以是只包含文字檔的 *.txt
  • RegistrySetting
    RegistrySetting 代表與 UE-V 代理程式組件的所需行為關聯之登錄機碼和值的容器。在這個類型中會定義四個子項目:PathNameExclude,以及一連串的 PathName 值。
  • FileSetting
    FileSetting 包含與檔案和檔案路徑關聯的參數。其定義四個子項目:RootPathFileMaskExclude。Root 為強制性,而其他項目則為選擇性。
  • Settings
    Settings 是套用至特定範本之所有設定的容器。它包含上述 Registry、File、SystemParameter 和 CustomAction 設定的執行個體。此外,也可包含下列子項目,其行為描述如下:

    元素 說明

    Asynchronous

    Asynchronous 設定套件可在不封鎖應用程式啟動的情況下套用,以便應用程式於設定仍在套用時繼續啟動。適用於可非同步套用的設定,例如透過 SystemParameterSetting 等 API 套用 get/set

    PreventOverlappingSynchronization

    根據預設,UE-V 只會在關閉使用範本的最後一個應用程式執行個體時,才會儲存應用程式的設定。當這個項目設定為 'false' 時,即使有其他應用程式執行個體正在執行,UE-V 也可以匯出設定。UE-V 隨附的適用範本 (包括 Common 項目區段的範本) 使用這個旗標來啟用共用設定,以便在應用程式關閉時一律匯出,同時避免在最後一個執行個體關閉之前匯出應用程式特定的設定。

Name 項目

強制:True

類型:字串

Name 可指定設定位置範本的唯一名稱。可在參考 WMI、PowerShell、事件檢視器和偵錯記錄中的範本時,用來顯示範本。一般而言,請避免參考版本資訊,因為這項資訊可從 ProductVersion 項目中取得。例如,指定 <Name>My Application</Name>,而不是 <Name>My Application 1.1</Name>

注意

UE-V 不會參考外部 DTD,因此無法在設定位置範本中使用具名實體。例如,請勿使用 &reg; 來參考註冊商標符號 ®。請改用標準編號參考來加入這些類型的特殊字元,例如以 &#174 表示 ® 字元。這項規則適用於本文件中的所有字串值。

如需字元實體的完整清單,請參閱 http://www.w3.org/TR/xhtml1/dtds.html。以 UTF 8 編碼的文件可直接包含 Unicode 字元。透過 UE-V 產生器儲存範本會自動將字元實體轉換成其 Unicode 表示。

ID 項目

強制:True

類型:字串

ID 可填入特定範本的唯一識別碼。這個標記會變成 UE-V 代理程式在執行階段用來參考範本的主要識別碼 (例如,請參閱 Get-UevTemplate 和 Get-UevTemplateProgram PowerShell Cmdlet 的輸出)。依照慣例,這個標記不應該包含任何空格,因此可簡化指令碼。您應該在這個項目中指定應用程式的版本號碼,以便識別範本,例如 <ID>MicrosoftCalculator6</ID><ID>MicrosoftOffice2010Win64</ID>

Version 項目

強制:True

類型:整數

最小值:0

最大值:2147483647

Version 可識別設定位置範本的版本,以便進行變更的管理追蹤。UE-V 產生器會在每次儲存範本時,自動將這個數值加上 1。請注意,這個欄位必須是正整數;不允許使用 <Version>2.5</Version> 等小數值。

**提示:**您可以使用 XML 註解標記 <!-- -->,來儲存版本變更的相關註解,例如:

  <!--
     Version History

     Version 1 Jul 05, 2012 Initial template created by Generator - Denise@Contoso.com
     Version 2 Jul 31, 2012 Added support for app.exe v2.1.3 - Mark@Contoso.com
     Version 3 Jan 01, 2013 Added font settings support - Mark@Contoso.com
     Version 4 Jan 31, 2013 Added support for plugin settings - Tony@Contoso.com
   -->
  <Version>4</Version>

重要

在下列情況下,系統會查詢這個值以判斷是否應該將新版範本套用至現有範本:

  • 排程的範本自動更新工作執行時

  • 執行 Update-UevTemplate PowerShell Cmdlet 時

  • 透過 WMI 呼叫 microsoft\uev:SettingsLocationTemplate Update 方法時

Author 項目

強制:False

類型:字串

Author 可識別設定位置範本的建立者。其支援兩個選擇性子項目:NameEmail。這兩個屬性是選擇性,但如果指定 Email 子項目,也必須指定 Name 項目。Author 表示設定位置範本之連絡人的全名,而 Email 則應該表示作者的電子郵件地址。建議您在公開發行的範本中包含這項資訊;例如,在 UE-V 範本庫中。

Processes 和 Process 項目

強制:True

類型:元素

Processes 至少包含一個 <Process> 項目,後者又包含下列子項目:FilenameArchitectureProductNameFileDescriptionProductVersionFileVersion。Filename 子項目為強制性,而其他項目則為選擇性。完整填入的項目包含類似下列範例中的標記:

    <Process>
      <Filename>MyApplication.exe</Filename>
      <Architecture>Win64</Architecture>
      <ProductName> MyApplication </ProductName>
      <FileDescription>MyApplication.exe</FileDescription>
      <ProductVersion>
        <Major Minimum="2" Maximum="2" />
        <Minor Minimum="0" Maximum="0" />
        <Build Minimum="0" Maximum="0" />
        <Patch Minimum="5" Maximum="5" />
      </ProductVersion>
      <FileVersion>
        <Major Minimum="2" Maximum="2" />
        <Minor Minimum="0" Maximum="0" />
        <Build Minimum="0" Maximum="0" />
        <Patch Minimum="5" Maximum="5" />
      </FileVersion>
    </Process>

Filename

強制:True

類型:字串

Filename 表示可執行檔在檔案系統中所顯示的實際檔案名稱。這個項目可指定 UE-V 用來評估是否將範本套用至處理序的主要準則。您必須在設定位置範本 XML 中指定這個項目。

有效的檔案名稱不能符合規則運算式 [^\\\?\*\|<>/:]+;也就是說,檔案名稱不能包含反斜線字元、星號或問號萬用字元、縱線字元、大於或小於符號、正斜線,或者冒號 (\ ?* | < > / 或 :字元)。

提示:若要對這個 Regex 測試字串,請使用 PowerShell 命令視窗,並以您的檔案名稱替代可執行檔的名稱:

"YourFileName.exe" -match "[\\\?\*\|<>/:]+"

True 表示這個字串包含無效的字元。以下是無效值的一些範例:

  • \\server\share\program.exe

  • Program*.exe

  • Pro?ram.exe

  • Program<1>.exe

注意

UE-V 產生器會將大於和小於字元分別編碼為 &gt; 和 &lt;。

在罕見的情況下,FileName 值不一定會包含 .exe 副檔名,但它應該指定為值的一部分。例如,您應該指定 <Filename>MyApplictication.exe</Filename>,而不是 <Filename>MyApplictication</Filename>。如果可執行檔的實際名稱為 "MyApplication.exe",第二個範例不會將範本套用至處理序。

架構

強制:False

類型:架構 (字串)

Architecture 表示已編譯目標可執行檔的處理器架構。有效值包括代表 32 位元應用程式的 Win32,或代表 64 位元應用程式的 Win64。如果存在,這個標記會將設定位置範本的適用性限制為特定應用程式架構。例如,比較 UE-V 隨附的 %ProgramFiles%\Microsoft User Experience Virtualization\templates\ MicrosoftOffice2010Win32.xml 和 MicrosoftOffice2010Win64.xml 檔案。當可執行檔的不同版本之間的相對路徑變更時,或者如果從某個處理器架構移至另一個處理器架構時已加入或移除設定,這個項目可能會很有用。

如果這個項目不存在,設定位置範本會忽略該處理序的架構,並在檔案名稱和其他屬性適用時,同時套用至 32 和 64 位元處理序。

注意

UE-V 在這個版本中不支援 ARM 處理器。

ProductName

強制:False

類型:字串

ProductName 是可用來識別產品以便進行管理或報告的選擇性項目。ProductName 與 Filename 不同,其值不受規則運算式的限制。這可讓您在可執行檔名稱不是那麼明顯時,更容易了解處理序的描述。例如:

    <Process>
      <Filename>MyApplication.exe</Filename>
      <ProductName>My Application 6.x by Contoso.com</ProductName>
      <ProductVersion>
        <Major Minimum="6" Maximum="6" />
      </ProductVersion>
    </Process>

FileDescription

強制:False

類型:字串

FileDescription 是允許可執行檔管理性描述的選擇性標記。這是任意文字欄位,可在需要識別可執行檔的功能時,用來區別軟體套件中的多個可執行檔。

例如,在適用的應用程式中,提供有關兩個可執行檔 (MyApplication.exe 和 MyApplicationHelper.exe) 功能的提醒,可能會很有用 (如下所示):

<Processes>
 
   <Process>
      <Filename>MyApplication.exe</Filename>
      <FileDescription>My Application Main Engine</ FileDescription>
      <ProductVersion>
        <Major Minimum="6" Maximum="6" />
      </ProductVersion>
    </Process>
    <Process>
      <Filename>MyApplicationHelper.exe</Filename>
      <FileDescription>My Application Background Process Executable</FileDescription>
      <ProductVersion>
        <Major Minimum="6" Maximum="6" />
      </ProductVersion>
    </Process>
</Processes>

ProductVersion

強制:False

類型:字串

ProductVersion 表示檔案的主要和次要產品版本,以及組建和修補程式等級。ProductVersion 是選擇性項目,但如果指定,則至少必須包含 Major 子項目。其值必須以 Minimum="X" Maximum="Y" 格式表示範圍,其中 X 和 Y 是整數。Minimum 和 Maximum 值可以相同。

產品和檔案版本項目可能會保留未設定。這樣做可讓範本「無從驗證版本」,亦即範本會套用至指定可執行檔的所有版本。

範例 1:

產品版本:1.0 (指定於 UE-V 產生器中) 會產生下列 XML:

      <ProductVersion>
        <Major Minimum="1" Maximum="1" />
        <Minor Minimum="0" Maximum="0" />
      </ProductVersion>

範例 2:

檔案版本:5.0.2.1000 (指定於 UE-V 產生器中) 會產生下列 XML:

      <FileVersion>
        <Major Minimum="5" Maximum="5" />
        <Minor Minimum="0" Maximum="0" />
        <Build Minimum="2" Maximum="2" />
        <Patch Minimum="1000" Maximum="1000" />
      </FileVersion>

不正確的範例 1 - 不完整的範圍:

只有 Minimum 屬性。範圍中必須也包含 Maximum。

      <ProductVersion>
        <Major Minimum="2" />
      </ProductVersion>

不正確的範例 2 - 已指定 Minor 但沒有 Major 項目:

只有 Minor 項目。必須也包含 Major。

      <ProductVersion>
        <Minor Minimum="0" Maximum="0" />
      </ProductVersion>

FileVersion

強制:False

類型:字串

FileVersion 可區別已發行應用程式的發行版本,以及元件可執行檔的內部組建詳細資料。對於大多數商業應用程式而言,這些數值是相同的。在兩者不同的情況下,檔案的產品版本表示檔案的一般版本識別碼,而檔案版本則表示檔案的特定組建 (例如 Hotfix 或更新)。如此可唯一識別檔案,而不會中斷偵測邏輯。

若要判斷特定可執行檔的產品版本和檔案版本,請以滑鼠右鍵按一下 Windows 檔案總管中的檔案,選取 [內容],然後按一下 [詳細資料] 索引標籤。

包括應用程式的 FileVersion 項目可更細微地微調偵測邏輯,但這對大多數應用程式而言絕非必要。系統會先檢查 ProductVersion 項目設定,再檢查 FileVersion;然後套用較嚴格的設定。

FileVersion 的子項目和語法規則與 ProductVersion 相同。

      <Process>
        <Filename>MSACCESS.EXE</Filename>
        <Architecture>Win32</Architecture>
        <ProductVersion>
          <Major Minimum="14" Maximum="14" />
          <Minor Minimum="0" Maximum="0" />
        </ProductVersion>
        <FileVersion>
          <Major Minimum="14" Maximum="14" />
          <Minor Minimum="0" Maximum="0" />
        </FileVersion>
      </Process>

Application 項目

Application 是套用至特定應用程式之設定的容器。它是下列欄位/類型的集合。

欄位/類型 說明

名稱

指定設定位置範本的唯一名稱。可在參考 WMI、PowerShell、事件檢視器和偵錯記錄中的範本時,用來顯示範本。如需詳細資訊,請參閱Name 項目。

ID

填入特定範本的唯一識別碼。這個標記會變成 UE-V 代理程式在執行階段用來參考範本的主要識別碼。如需詳細資訊,請參閱ID 項目。

說明

範本的選擇性描述。

LocalizedNames

在 UI 中顯示的選擇性名稱,已依語言地區設定當地語系化。

LocalizedDescriptions

依語言地區設定當地語系化的選擇性範本描述。

版本

識別設定位置範本的版本,以便進行變更的管理追蹤。如需詳細資訊,請參閱Version 項目。

DeferToMSAccount

控制是否要搭配 Microsoft 帳戶啟用這個範本。如果針對使用者或在電腦上啟用 MSA 同步處理,則會自動停用這個範本。

DeferToOffice365

類似於 MSA,這個欄位可控制是否要搭配 Office365 啟用這個範本。如果正在使用 Office 365 同步處理設定,則會自動停用這個範本。

Processes

一個或多個 Process 項目集合的容器。如需詳細資訊,請參閱Processes 和 Process 項目。

Settings

套用至特定範本之所有設定的容器。它包含 Registry、File、SystemParameter 和 CustomAction 設定的執行個體。如需詳細資訊,請參閱資料類型中的 Settings

Common 項目

Common 類似於 Application 項目,但一律會與兩個或多個 Application 項目關聯。Common 區段代表可在這些 Application 執行個體之間共用的一組設定。它是下列欄位/類型的集合。

欄位/類型 說明

名稱

指定設定位置範本的唯一名稱。可在參考 WMI、PowerShell、事件檢視器和偵錯記錄中的範本時,用來顯示範本。如需詳細資訊,請參閱Name 項目。

ID

填入特定範本的唯一識別碼。這個標記會變成 UE-V 代理程式在執行階段用來參考範本的主要識別碼。如需詳細資訊,請參閱ID 項目。

說明

範本的選擇性描述。

LocalizedNames

在 UI 中顯示的選擇性名稱,已依語言地區設定當地語系化。

LocalizedDescriptions

依語言地區設定當地語系化的選擇性範本描述。

版本

識別設定位置範本的版本,以便進行變更的管理追蹤。如需詳細資訊,請參閱Version 項目。

DeferToMSAccount

控制是否要搭配 Microsoft 帳戶啟用這個範本。如果針對使用者或在電腦上啟用 MSA 同步處理,則會自動停用這個範本。

DeferToOffice365

類似於 MSA,這個欄位可控制是否要搭配 Office365 啟用這個範本。如果正在使用 Office 365 同步處理設定,則會自動停用這個範本。

Settings

套用至特定範本之所有設定的容器。它包含 Registry、File、SystemParameter 和 CustomAction 設定的執行個體。如需詳細資訊,請參閱資料類型中的 Settings

SettingsLocationTemplate 項目

這個項目可定義單一應用程式或一組應用程式的設定。

欄位/類型 說明

名稱

指定設定位置範本的唯一名稱。可在參考 WMI、PowerShell、事件檢視器和偵錯記錄中的範本時,用來顯示範本。如需詳細資訊,請參閱Name 項目。

ID

填入特定範本的唯一識別碼。這個標記會變成 UE-V 代理程式在執行階段用來參考範本的主要識別碼。如需詳細資訊,請參閱ID 項目。

說明

範本的選擇性描述。

LocalizedNames

在 UI 中顯示的選擇性名稱,已依語言地區設定當地語系化。

LocalizedDescriptions

依語言地區設定當地語系化的選擇性範本描述。

附錄:SettingsLocationTemplate.xsd

下列 SettingsLocationTemplate.xsd 檔案顯示其項目、子項目、屬性和參數:

<?xml version="1.0" encoding="utf-8"?>
<xs:schema id="UevSettingsLocationTemplate"
  targetNamespace="https://schemas.microsoft.com/UserExperienceVirtualization/2013/SettingsLocationTemplate"
  elementFormDefault="qualified"
  xmlns="https://schemas.microsoft.com/UserExperienceVirtualization/2013/SettingsLocationTemplate"
  xmlns:mstns="https://schemas.microsoft.com/UserExperienceVirtualization/2013/SettingsLocationTemplate"
  xmlns:xs="http://www.w3.org/2001/XMLSchema">

  <xs:simpleType name="Guid">
    <xs:restriction base="xs:string">
      <xs:pattern value="\{[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}\}" />
    </xs:restriction>
  </xs:simpleType>

  <xs:simpleType name="FilenameString">
    <xs:restriction base="xs:string">
      <xs:pattern value="[^\\\?\*\|&lt;&gt;/:]+" />
    </xs:restriction>
  </xs:simpleType>

  <xs:simpleType name="IDString">
    <xs:restriction base="xs:string">
      <xs:pattern value="[^\\\?\*\|&lt;&gt;/:.]+" />
    </xs:restriction>
  </xs:simpleType>

  <xs:simpleType name="TemplateVersion">
    <xs:restriction base="xs:integer">
      <xs:minInclusive value="0" />
      <xs:maxInclusive value="2147483647" />
    </xs:restriction>
  </xs:simpleType>

  <xs:complexType name="Empty">
    <xs:sequence/>
  </xs:complexType>

  <xs:complexType name="LocalizedString">
    <xs:simpleContent>
      <xs:extension base="xs:string">
        <xs:attribute name="Locale" type="xs:string" use="required"/>
      </xs:extension>
    </xs:simpleContent>
  </xs:complexType>

  <xs:complexType name="LocalizedName">
    <xs:sequence>
      <xs:element name="Name" type="LocalizedString" minOccurs="1" maxOccurs="unbounded" />
    </xs:sequence>
  </xs:complexType>

  <xs:complexType name="LocalizedDescription">
    <xs:sequence>
      <xs:element name="Description" type="LocalizedString" minOccurs="1" maxOccurs="unbounded" />
    </xs:sequence>
  </xs:complexType>

  <xs:complexType name="Author">
    <xs:all>
      <xs:element name="Name" type="xs:string" minOccurs="1" />
      <xs:element name="Email" type="xs:string" minOccurs="0" />
    </xs:all>
  </xs:complexType>

  <xs:complexType name="Range">
    <xs:attribute name="Minimum" type="xs:integer" use="required"/>
    <xs:attribute name="Maximum" type="xs:integer" use="required"/>
  </xs:complexType>

  <xs:complexType name="ProcessVersion">
    <xs:sequence>
      <xs:element name="Major" type="Range" minOccurs="1" />
      <xs:element name="Minor" type="Range" minOccurs="0" />
      <xs:element name="Build" type="Range" minOccurs="0" />
      <xs:element name="Patch" type="Range" minOccurs="0" />
    </xs:sequence>
  </xs:complexType>

  <xs:simpleType name="Architecture">
    <xs:restriction base="xs:string">
      <xs:enumeration value="Win32"/>
      <xs:enumeration value="Win64"/>
    </xs:restriction>
  </xs:simpleType>

  <xs:complexType name="Process">
    <xs:sequence>
      <xs:element name="Filename" type="FilenameString" minOccurs="1" />
      <xs:element name="Architecture" type="Architecture" minOccurs="0" />
      <xs:element name="ProductName" type="xs:string" minOccurs="0" />
      <xs:element name="FileDescription" type="xs:string" minOccurs="0" />
      <xs:element name="ProductVersion" type="ProcessVersion" minOccurs="0" maxOccurs="unbounded"/>
      <xs:element name="FileVersion" type="ProcessVersion" minOccurs="0" maxOccurs="unbounded"/>
    </xs:sequence>
  </xs:complexType>

  <xs:complexType name="Processes">
    <xs:sequence>
      <xs:choice minOccurs="1">
        <xs:element name="Process" type="Process" />
        <xs:element name="ShellProcess" type="Empty" />
      </xs:choice>
      <xs:element name="Process" type="Process" minOccurs="0" maxOccurs="unbounded" />
    </xs:sequence>
  </xs:complexType>

  <xs:complexType name="Path">
    <xs:simpleContent>
      <xs:extension base="xs:string">
        <xs:attribute name="Recursive" type="xs:boolean" default="false"/>
        <xs:attribute name="DeleteIfNotFound" type="xs:boolean" default="false"/>
      </xs:extension>
    </xs:simpleContent>
  </xs:complexType>

  <xs:complexType name="RegistrySetting">
    <xs:sequence>
      <xs:element name="Path" type="Path" />
      <xs:element name="Name" type="xs:string" minOccurs="0" maxOccurs="unbounded" />
      <xs:element name="Exclude" minOccurs="0" maxOccurs="unbounded">
        <xs:complexType>
          <xs:sequence>
            <xs:element name="Path" type="Path" minOccurs="0" />
            <xs:element name="Name" type="xs:string" minOccurs="0" maxOccurs="unbounded" />
          </xs:sequence>
        </xs:complexType>
      </xs:element>
    </xs:sequence>
  </xs:complexType>

  <xs:complexType name="FileSetting">
    <xs:sequence>

      <xs:element name="Root">
        <xs:complexType>
          <xs:choice>
            <xs:element name="KnownFolder" type="Guid" />
            <xs:element name="RegistryEntry" type="xs:string" />
            <xs:element name="EnvironmentVariable" type="xs:string" />
          </xs:choice>
        </xs:complexType>
      </xs:element>

      <xs:element name="Path" minOccurs="0" type="Path" />
      <xs:element name="FileMask" type="xs:string" minOccurs="0" maxOccurs="unbounded"/>

      <xs:element name="Exclude" minOccurs="0" maxOccurs="unbounded">
        <xs:complexType>
          <xs:sequence>
            <xs:element name="Path" type="Path" minOccurs="0" />
            <xs:element name="FileMask" type="xs:string" minOccurs="0" maxOccurs="unbounded" />
          </xs:sequence>
        </xs:complexType>
      </xs:element>

    </xs:sequence>
  </xs:complexType>

  <xs:simpleType name="SystemParameterSetting">
    <xs:restriction base="xs:string">

      <!-- Accessibility parameters -->
      <xs:enumeration value="AccessTimeout"/>
      <xs:enumeration value="AudioDescription"/>
      <xs:enumeration value="ClientAreaAnimation"/>
      <xs:enumeration value="DisableOverlappedContent"/>
      <xs:enumeration value="FilterKeys"/>
      <xs:enumeration value="FocusBorderHeight"/>
      <xs:enumeration value="FocusBorderWidth"/>
      <xs:enumeration value="HighContrast"/>
      <xs:enumeration value="MessageDuration"/>
      <xs:enumeration value="MouseClickLock"/>
      <xs:enumeration value="MouseClickLockTime"/>
      <xs:enumeration value="MouseKeys"/>
      <xs:enumeration value="MouseSonar"/>
      <xs:enumeration value="MouseVanish"/>
      <xs:enumeration value="ScreenReader"/>
      <xs:enumeration value="ShowSounds"/>
      <xs:enumeration value="SoundSentry"/>
      <xs:enumeration value="StickyKeys"/>
      <xs:enumeration value="ToggleKeys"/>

      <!-- Input parameters -->
      <xs:enumeration value="Beep"/>
      <xs:enumeration value="BlockSendInputResets"/>
      <xs:enumeration value="DefaultInputLang"/>
      <xs:enumeration value="DoubleClickTime"/>
      <xs:enumeration value="DoubleClkHeight"/>
      <xs:enumeration value="DoubleClkWidth"/>
      <xs:enumeration value="KeyboardCues"/>
      <xs:enumeration value="KeyboardDelay"/>
      <xs:enumeration value="KeyboardPref"/>
      <xs:enumeration value="KeyboardSpeed"/>
      <xs:enumeration value="Mouse"/>
      <xs:enumeration value="MouseButtonSwap"/>
      <xs:enumeration value="MouseHoverHeight"/>
      <xs:enumeration value="MouseHoverTime"/>
      <xs:enumeration value="MouseHoverWidth"/>
      <xs:enumeration value="MouseSpeed"/>
      <xs:enumeration value="MouseTrails"/>
      <xs:enumeration value="SnapToDefButton"/>
      <xs:enumeration value="WheelScrollChars"/>
      <xs:enumeration value="WheelScrollLines"/>

      <!-- Desktop parameters (limited subset) -->
      <xs:enumeration value="DeskWallpaper"/>
      <xs:enumeration value="DesktopColor"/>

    </xs:restriction>
  </xs:simpleType>

  <xs:complexType name="Settings">
    <xs:sequence>
      <xs:element name="Asynchronous" type="xs:boolean" minOccurs="0" />
      <xs:element name="PreventOverlappingSynchronization" type="xs:boolean" minOccurs="0" />
      <xs:choice minOccurs="0" maxOccurs="unbounded">
        <xs:element name="Registry" type="RegistrySetting" />
        <xs:element name="File" type="FileSetting" />
        <xs:element name="SystemParameter" type="SystemParameterSetting" />
      </xs:choice>
    </xs:sequence>
  </xs:complexType>

  <xs:complexType name="Common">
    <xs:sequence>
      <xs:element name="Name" type="xs:string" />
      <xs:element name="ID" type="IDString" />
      <xs:element name="Description" type="xs:string" minOccurs="0" />
      <xs:element name="LocalizedNames" type="LocalizedName" minOccurs="0" />
      <xs:element name="LocalizedDescriptions" type="LocalizedDescription" minOccurs="0" />
      <xs:element name="Version" type="xs:integer" />
      <xs:element name="DeferToMSAccount" type="Empty"  minOccurs="0" />
      <xs:element name="Settings" type="Settings" />
    </xs:sequence>
  </xs:complexType>

  <xs:complexType name="Application">
    <xs:sequence>
      <xs:element name="Name" type="xs:string" />
      <xs:element name="ID" type="IDString" />
      <xs:element name="Description" type="xs:string" minOccurs="0" />
      <xs:element name="LocalizedNames" type="LocalizedName" minOccurs="0" />
      <xs:element name="LocalizedDescriptions" type="LocalizedDescription" minOccurs="0" />
      <xs:element name="Version" type="xs:integer" />
      <xs:element name="DeferToMSAccount" type="Empty"  minOccurs="0" />
      <xs:element name="Processes" type="Processes" />
      <xs:element name="Settings" type="Settings" />
    </xs:sequence>
  </xs:complexType>


  <xs:element name="SettingsLocationTemplate">
    <xs:complexType>
      <xs:sequence>

        <xs:element name="Name" type="xs:string" />
        <xs:element name="ID" type="IDString" />
        <xs:element name="Description" type="xs:string" minOccurs="0" />
        <xs:element name="LocalizedNames" type="LocalizedName" minOccurs="0" />
        <xs:element name="LocalizedDescriptions" type="LocalizedDescription" minOccurs="0" />

        <xs:choice>

          <!-- Single application -->
          <xs:sequence>
            <xs:element name="Version" type="TemplateVersion" />
            <xs:element name="Author" type="Author" minOccurs="0" />
            <xs:element name="DeferToMSAccount" type="Empty"  minOccurs="0" />
            <xs:element name="Processes" type="Processes" />
            <xs:element name="Settings" type="Settings" />
          </xs:sequence>

          <!-- Suite of applications -->
          <xs:sequence>
            <xs:element name="ManageSuiteOnly" type="xs:boolean" minOccurs="0" />
            <xs:element name="Author" type="Author" minOccurs="0" />
            <xs:element name="Common" type="Common" />
            <xs:element name="Application" type="Application" minOccurs="2" maxOccurs="unbounded" />
          </xs:sequence>

        </xs:choice>

      </xs:sequence>
    </xs:complexType>
  </xs:element>
  <!-- SettingsLocationTemplate -->

</xs:schema>

您對於 UE-V 有任何建議嗎?

您可以在這裡加入您的建議,或對建議進行票選。您如有 UE-V 方面的問題,請利用 UE-V TechNet 論壇

另請參閱

概念

使用自訂 UE-V 2.x 範本和 UE-V 2.x Generator

其他資源

UE-V 2.x 的技術參考