Skip to main content
Version: 4.1 (2026-H2)

Template Distribution

The Template Distribution document function automatically distributes files, fonts, and configuration files to endpoints (client machines). It is used primarily for external distribution templates and Outlook design templates.

note

This document function is available for external distribution templates and Outlook design templates.

Basic Structure

The root element is <Configuration>. The elements are expected in this order (all optional): Path, LockFile, Shortcut, UpdateMode, Files, Registry, Cleanup.

<Configuration>
<Path>%APPDATA%\MyApp\</Path>
<UpdateMode>Merge</UpdateMode>
<Files>
<File Source="config.xml" Target="settings\config.xml" />
<File Source="logo.png" Target="assets\logo.png" />
</Files>
</Configuration>
note

The configuration is scriptable: <If Condition="…"> blocks let you include or exclude elements depending on system variables (e.g. the installed Office version or bitness).

<Path>

Target path of the distribution. Environment variables (e.g. %APPDATA%, %USERPROFILE%) are resolved. With UpdateMode="ViaFiles", the path may be left empty.

<LockFile>

A file whose lock is checked before distribution. If the file cannot be opened exclusively (e.g. because the associated Office application has it open), the distribution is skipped.

<LockFile>Beispiel.ppam</LockFile>

<Shortcut>

Optional directory in which a Windows shortcut to the <LockFile> is created (e.g. required for Excel add-ins).

<Shortcut>%APPDATA%\Microsoft\Excel\XLSTART\</Shortcut>

<UpdateMode>

Controls how the distribution is carried out:

ValueDescription
MergeExisting files are added/updated, not deleted (default).
ReplaceThe target path is reconciled with the package content; surplus files are removed.
RemoveRemoves the target directory (<Path>).
ViaFilesDistributes individual files to individual targets as defined in <Files>.
InstallFontInstalls the included fonts system-wide.
RemoveFontUninstalls the included fonts.

<Files>

List of files to be distributed:

<Files>
<File Source="vorlage.dotx" Target="Vorlagen\vorlage.dotx" />
<File Target="%APPDATA%\MyApp\readme.txt">Content of the generated text file</File>
</Files>
AttributeDescription
SourceFile name or pattern in the template package (e.g. vorlage.dotx or *.dotx). Optional.
TargetTarget path/file name including environment variables. Required.
note

If you set the content of a <File> element (instead of Source), a text file with that content is created at the target — e.g. <File Target="…\theme.config">DemoStyle</File>.

Registry Actions (<Registry>)

Creates or updates registry keys and values. The actions run with the privileges of the current process and exclusively on HKCU.

<Registry>
<RegistryKey Root="HKCU" View="Default" Key="Software\Microsoft\Office\16.0\PowerPoint\AddIns\MyAddIn" Action="CreateAndUpdate">
<RegistryValue Type="String" Name="Path" Expand="true">%APPDATA%\MyAddIn\MyAddIn.ppam</RegistryValue>
<RegistryValue Type="DWord" Name="AutoLoad">00000001</RegistryValue>
</RegistryKey>
</Registry>

<RegistryKey>:

AttributeDescription
KeyRegistry key path (e.g. Software\Microsoft\Office\16.0\…). Required.
ViewRegistry view: Default, Registry32, Registry64.
RootRegistry root — only HKCU is supported.
ActionCreateAndUpdate (default), Create, Update, Remove.

<RegistryValue> (child element of <RegistryKey>; the value is held in the element content):

AttributeDescription
NameName of the registry value. Required.
TypeValue type: String, ExpandString, Binary, DWord, MultiString, QWord (corresponding to REG_SZ, REG_EXPAND_SZ, REG_BINARY, REG_DWORD, REG_MULTI_SZ, REG_QWORD). Required.
ExpandWhen set to true, environment variables in the value are resolved.

Alternatively, a .reg file can be imported — optionally redirected into a specific key:

<Registry>
<RegistryFile ImportInKey="HKEY_CURRENT_USER\Software\MyApp">deploy.reg</RegistryFile>
</Registry>

Cleanup (<Cleanup>)

Defines actions that are executed on uninstall or — depending on Mode — before each distribution:

<Cleanup Mode="OnCleanup">
<File Path="%APPDATA%\MyApp" />
<RegistryValue Root="HKCU" View="Default" Key="Software\Microsoft\Office\16.0\PowerPoint\AddIns\MyAddIn" Name="Path" />
<RegistryKey Root="HKCU" View="Default" Key="Software\Microsoft\Office\16.0\PowerPoint\AddIns\MyAddIn" />
</Cleanup>
Mode valueDescription
OnCleanupOn uninstall only (default).
OnCleanupAndDistributeOn uninstall and before each new distribution.
ElementAttributes
<File>Path (file or directory to be deleted).
<RegistryKey>Key, View — deletes the key.
<RegistryValue>Key, View, Name — deletes the individual value.

Installing Fonts

<Configuration>
<UpdateMode>InstallFont</UpdateMode>
<Files>
<File Source="CorporateFont-Regular.ttf" Target="" />
<File Source="CorporateFont-Bold.ttf" Target="" />
</Files>
</Configuration>

With <UpdateMode>InstallFont</UpdateMode>, the listed fonts are installed system-wide on the client.

Distributing Outlook Design Templates

For Outlook design templates, the package content is treated as a ZIP — for this, set SourceTemplateDocumentType="Zip" on the root element:

<Configuration SourceTemplateDocumentType="Zip">
<UpdateMode>ViaFiles</UpdateMode>
<Files>
<File Source="*.dotx" Target="%APPDATA%\Microsoft\QuickStyles\DemoStyle.dotx" />
<File Target="%APPDATA%\Microsoft\QuickStyles\Theme.config">DemoStyle</File>
</Files>
<Registry>
<RegistryFile>mailsettings.reg</RegistryFile>
</Registry>
</Configuration>