请问,是否有人可以提供完整的.wxs示例来创建MSI包?
我已经读过这个帖子了: How to install Open Type Fonts using Wix
但它对我没有帮助。我会在那里添加评论,但我没有足够的声望点:/
有什么问题?我收到以下错误:
D:\share\IT\install-MSI\MSI věvoj\fonty-2016>candle font-Gabka2.wxs
Windows Installer XML Toolset Compiler version 3.10.2.2516
Copyright (c) Outercurve Foundation. All rights reserved.
font-Gabka2.wxs
D:\share\IT\install-MSI\MSI věvoj\fonty-2016\font-Gabka2.wxs(14) : warning CNDL1091 : The Package/@Id attribute has been set. Setting this attribute will allow nonidentical .msi files to have the same package code. This may be a problem because the package code is the primary identifier used by the installer to search for and validate the correct package for a given installation. If a package is changed without changing the package code, the installer may not use the newer package if both are still accessible to the installer. Please remove the Id attribute in order to automatically generate a new package code for each new .msi file.
D:\share\IT\install-MSI\MSI věvoj\fonty-2016>light font-Gabka2.wixobj
Windows Installer XML Toolset Linker version 3.10.2.2516
Copyright (c) Outercurve Foundation. All rights reserved.
D:\share\IT\install-MSI\MSI věvoj\fonty-2016\font-Gabka2.wxs(34) : error LGHT0094 : Unresolved reference to symbol 'WixAction:InstallExecuteSequence/RemoveExistingProducts' in section 'Product:*'.
源WXS文件代码:
<?xml version='1.0'?>
<?define ProductName = "Font Gabka2 (SVČ Lužánky)"?>
<?define PrevProductVersion = "1.0"?> <!-- Match previous version, use "1.0.0" for new install if not known -->
<?define ProductVersion = "1.0"?> <!-- Match new version -->
<?define ProductCode = "PUT-GUID-HERE"?> <!-- Re-generate for new upgrade! (http://www.guidgen.com/) -->
<?define ProductUpgradeCode = "PUT-GUID-HERE"?> <!-- When upgrading, overwrite with previous ProductCode here. -->
<Wix xmlns='http://schemas.microsoft.com/wix/2006/wi'>
<Product Id='*'
UpgradeCode="$(var.ProductUpgradeCode)"
Name="$(var.ProductName)"
Language='1033'
Version='$(var.ProductVersion)'
Manufacturer='SVČ Lužánky'>
<Package Id='$(var.ProductCode)'
Description='$(var.ProductName) $(var.ProductVersion)'
InstallerVersion='200'
Compressed='yes' />
<Media Id='1' Cabinet='setup.cab' EmbedCab='yes' />
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="FontsFolder">
<Component Id="InstallFonts" Guid="*"> <!-- New GUID HERE FOR NEW FILE (no changes for upgrade, though) -->
<File Id="Gabka2.ttf" Source="Gabka2.ttf" TrueType="yes" KeyPath="yes" />
</Component>
</Directory>
</Directory>
<Upgrade Id="$(var.ProductUpgradeCode)">
<UpgradeVersion Minimum="$(var.ProductVersion)"
IncludeMinimum="no"
OnlyDetect="yes"
Language="1033"
Property="NEWPRODUCTFOUND" />
<UpgradeVersion Minimum="$(var.PrevProductVersion)"
IncludeMinimum="yes"
Maximum="$(var.ProductVersion)"
IncludeMaximum="no"
Language="1033"
Property="UPGRADEFOUND" />
</Upgrade>
<Property Id="ARPSYSTEMCOMPONENT" Value="1" />
<Feature Id='InstallFeature' Title='Install Feature' Level='1'>
<ComponentRef Id='InstallFonts' />
</Feature>
<!-- Prevent downgrading -->
<CustomAction Id="PreventDowngrading" Error="Newer version already installed." />
<InstallUISequence>
<Custom Action="PreventDowngrading" After="FindRelatedProducts">NEWPRODUCTFOUND</Custom>
</InstallUISequence>
</Product>
</Wix>
谢谢
PS:如何在一个MSI中安装更多TTF字体?如果我添加更多文件,我会收到如下错误:
error CNDL0042 : The Component element has multiple key paths set. The key path may only be set to 'yes' in extension elements that support it or one of the following locations: Component/@KeyPath, File/@KeyPath, RegistryValue/@KeyPath, or ODBCDataSource/@KeyPath.
PS2:我已将此项目https://github.com/pennmanor/wix-wrapper用作我的新WIX-MSI字体项目的模板库。
答案 0 :(得分:2)
有些错误:
不要修复包ID,使用&#34; *&#34;所以你在每次构建时都会得到一个新值。
您的降级预防不需要自定义操作或升级元素。使用majorupgrade元素 - 它似乎拥有你需要的一切。
字体错误消息似乎不适用于您发布的源,因为它引用了组件中的多个文件。
答案 1 :(得分:1)
以下是此类问题的解决方案:
1)&#34; ... 错误CNDL0042:Component元素有多个键 ...&#34;问题:
只需删除&#34; KeyPath&#34;属性完全没有它
2)多种字体: 当1)完成时,包含更多字体并简单添加更多&#34;文件&#34;标签到&#34;组件&#34;子树。小心拥有独特的身份。例如:
<Component Id="InstallFonts" Guid="a028a73b-xxxx-xxxx-xxxx-da4e3e03aef5"> <!-- New GUID HERE FOR NEW FILE (no changes for upgrade, though) -->
<File Id="Gabka2.ttf" Source="Gabka2.ttf" TrueType="yes" />
<File Id="Gabka2_bold.ttf" Source="Gabka2_bold.ttf" TrueType="yes" />
</Component>
3)&#34; ...错误LGHT0094:未解决的符号引用... &#34;问题:
通过添加:
来解决此问题<InstallExecuteSequence>
<RemoveExistingProducts After="InstallFinalize" />
</InstallExecuteSequence>
在最终产品标签之前。
4)编码/字符/代码问题(&#34; ...错误LGHT0311:提供了一个字符串...... &#34;):
通过添加&#34;代码页&#34;属于主要&#34;产品&#34;标签,即:
<Product Id='*'
Codepage="utf-8"
UpgradeCode="$(var.ProductUpgradeCode)"
Name="$(var.ProductName)"
Language='1033'
Version='$(var.ProductVersion)'
...
希望这有帮助,#crysman