【发布时间】:2016-12-02 15:48:45
【问题描述】:
我正在尝试使用 WixUI_Advanced UI 让“安装范围”屏幕在 WiX 中工作,虽然我没有收到任何错误,但它根本无法工作。
Here 是 Fire Giant(WiX 开发)教程页面,它一步一步地完成安装屏幕工作的过程,我正在关注它。我也在关注一本说同样内容的教科书。
我使用的是 WiX 3.10,这很可能是问题所在——也许教程已经过时了?我使用的教科书适用于 WiX 3.6。
步骤如下:
1:确保您的项目中有对 WixUIExtension 的引用。如果我可以显示我的解决方案资源管理器的屏幕截图,您会看到参考资料在那里。话虽如此,我正在关注的教科书说要使用参考,而 Fire Giant 教程中的语言说:
对话框集在 WiX 源代码的 WixUIExtension 中的文件 WixUI_Advanced.wxs 中定义。
我认为意思是“添加引用”,但是......
2:在标记中添加对 WixUI_Advanced 的引用(Fire Giant 教程根本没有提到这一点——他们要么忽略了这个必要的步骤,要么没有包含它):
<UIRef Id="WixUI_Advanced"/>
3:确保您有一个名为 APPLICATIONFOLDER 的目录:
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFilesFolder">
<Directory Id="APPLICATIONFOLDER" Name="MyFolder"/>
</Directory>
</Directory>
4:添加 Id 为 ApplicationFolderName 的特定属性。该值将设置安装目录的名称,因为它将显示在 UI 中。 5:添加另一个 Id 为 WixAppFolder 的属性,其值为 WixPerMachinePerFolder 或 ...PerUser。这将使用户可以选择哪一个:
<Property Id="ApplicationFolderName" Value="MyProgram"/>
<Property Id="WixAppFolder" Value="WixPerMachineFolder"/>
就是这样!该程序运行时没有错误消息和警告,但除了安装我正在安装的东西(文本文件)之外,它什么也不做。日志文件不显示错误。
我知道 UI 确实在发生,因为我可以更改许可证 rtf 文件。
日志还显示某些特定操作被跳过。这是日志文件中的一个条目:
动作开始时间 13:46:38:WixSetDefaultPerMachineFolder。
MSI (c) (04:A4) [13:46:38:195]:属性更改:添加 WixPerMachineFolder 属性。其值为 'C:\Program Files******* 返回值 1。
MSI (c) (04:A4) [13:46:38:195]:跳过操作:WixSetPerUserFolder(条件为假)
MSI (c) (04:A4) [13:46:38:195]:执行操作:WixSetPerMachineFolder
MSI (c) (04:A4) [13:46:38:195]:注意:1: 2205 2: 3: ActionText
行动 13:44:54:WixSetDefaultPerUserFolder。
动作开始时间 13:44:54:WixSetDefaultPerUserFolder。
MSI (s) (88:C4) [13:44:54:159]:属性更改:添加 WixPerUserFolder 属性。它的值是'C:\Users***...'。
操作于 13:44:54 结束:WixSetDefaultPerUserFolder。返回值 1。
MSI (s) (88:C4) [13:44:54:159]:执行操作:WixSetDefaultPerMachineFolder
MSI (s) (88:C4) [13:44:54:159]: 注意: 1: 2205 2: 3: ActionText
行动 13:44:54:WixSetDefaultPerMachineFolder。
动作开始时间 13:44:54:WixSetDefaultPerMachineFolder。
MSI (s) (88:C4) [13:44:54:159]:属性更改:添加 WixPerMachineFolder 属性。它的值是'C:\Program Files\MyProgram'。
操作于 13:44:54 结束:WixSetDefaultPerMachineFolder。返回值 1。
MSI (s) (88:C4) [13:44:54:159]:跳过操作:WixSetPerUserFolder(条件为假)
MSI (s) (88:C4) [13:44:54:159]:跳过操作:WixSetPerMachineFolder(条件为假)
MSI (s) (88:C4) [13:44:54:159]:执行操作:CostFinalize
MSI (s) (88:C4) [13:44:54:159]:注意:1: 2205 2: 3: ActionText
这里是完整的代码:
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Product Id="*"
Name="WixUIAdvanced"
Language="1033"
Version="1.0.0.0"
Manufacturer="Microsoft"
UpgradeCode="f3410225-cde1-4067-a6e6-2e016d7cf38b">
<Package InstallerVersion="200"
Compressed="yes"
InstallScope="perMachine" />
<MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
<MediaTemplate EmbedCab="yes"/>
<UIRef Id="WixUI_Advanced"/>
<WixVariable Id="WixUILicenseRtf" Value="src\license.rtf"/>
<Property Id="ApplicationFolderName" Value="MyProgram"/>
<Property Id="WixAppFolder" Value="WixPerMachineFolder"/>
<Feature Id="ProductFeature"
Title="WixUIAdvanced"
Level="1">
<ComponentGroupRef Id="ProductComponents" />
</Feature>
</Product>
<Fragment>
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFilesFolder">
<Directory Id="APPLICATIONFOLDER"
Name="MyFolder"/>
</Directory>
</Directory>
</Fragment>
<Fragment>
<ComponentGroup Id="ProductComponents" Directory="APPLICATIONFOLDER">
<Component Id="ProductComponent">
<File Source="TextFile1.txt"/>
</Component>
</ComponentGroup>
</Fragment>
我使用的是 WiX 3.10,Visual Studio 2015。
【问题讨论】:
标签: user-interface wix