【发布时间】:2018-06-28 16:26:17
【问题描述】:
我想在安装 MSI 时安装一组 Open Type 字体。我正在使用 Wix 创建 MSI。
有什么建议吗?
【问题讨论】:
标签: fonts installation wix
我想在安装 MSI 时安装一组 Open Type 字体。我正在使用 Wix 创建 MSI。
有什么建议吗?
【问题讨论】:
标签: fonts installation wix
需要指定目录FontsFolder,并在文件上设置TrueType属性:
<DirectoryRef Id="FontsFolder">
<Component Id="MyFontsFonts" Guid="...">
<File Id="font1.ttf" Source="font1.ttf" TrueType="yes" />
<File Id="font2.ttf" Source="font2.ttf" TrueType="yes" />
</Component>
</DirectoryRef>
【讨论】:
error LGHT0094 : Unresolved reference to symbol 'Directory:FontsFolder',我还缺少什么吗?
对于安装字体,您必须在代码中设置两个部分:
<Feature Id="ProductFeature" Title="WixSetup" Level="1">
<ComponentGroupRef Id="ProductComponents" />
<ComponentRef Id="ApplicationShortcut" />
<ComponentRef Id="ApplicationShortcutDesktop" />
<ComponentRef Id="MyFontsFonts" />
</Feature>
.
.
.
<Directory Id="TARGETDIR" Name="SourceDir">
.
.
.
<Directory Id="FontsFolder">
<Component Id="MyFontsFonts" Guid="myGuid">
<File Id="font1.ttf" Source="Fonts\font1.ttf" TrueType="yes" />
</Component>
</Directory>
</Directory>
【讨论】:
我无法弄清楚DirectoryRef——也许这些年来有些事情发生了变化——但我在我的根目录TARGETDIR 中添加了一个Directory 并让它工作。就我而言,我需要在服务器上使用 Arial Narrow Bold:
<Directory Id="TARGETDIR" Name="SourceDir">
<!-- snip ... all my other stuff here -->
<Directory Id="FontsFolder">
<Component Id="ComponentFontArialNarrowBold" Guid="{65F4712A-EAA6-4801-9200-212A3593D6E2}">
<File Id="FileFontArialNarrowBold" Source="$(var.SolutionDir)Res\Fonts\ARIALNB.TTF" TrueType="yes" KeyPath="yes" />
</Component>
</Directory>
</Directory>
【讨论】:
FontsFolder,则会导致问题。它可以嵌套在任何目录中。它实际上并没有创建/安装到那个文件夹,它是一个特殊的文件夹。