【发布时间】:2012-04-12 15:20:33
【问题描述】:
我正在处理的 Wix 设置询问用户是否从桌面上的主程序安装快捷方式。
问题是在升级过程中,快捷方式被删除然后重新创建:
- 如果用户移动了图标,它可能会在其他地方重新创建(下一个可用空间从左上角开始)
- 如果用户在初始安装期间选择不创建图标,使用 UI 升级不会记住创建图标的复选框应默认为“未选中”,静默升级只会创建图标,尽管用户明确选择不创建此图标。
有没有简单的方法来妥善处理这种情况?
以下是关于我的 wix 设置的信息:
按机器安装
用户选择通过添加在“选择目标”的修改版本上的复选框来安装桌面快捷方式:
<Control Id="DesktopShortcutCheckBox" Type="CheckBox" X="20" Y="160" Width="290" Height="17" Property="INSTALLDESKTOPSHORTCUT" CheckBoxValue="[INSTALLDESKTOPSHORTCUT]" Text="!(loc.InstallDirDlgCreateDesktopShortcut)" />
在 UI 标签中我初始化了属性:
<Property Id="INSTALLDESKTOPSHORTCUT" Value="1"/>
这是使用 INSTALLDESKTOPSHORTCUT 条件创建快捷方式的组件:
<Directory Id="DesktopFolder" Name="Desktop">
<Component Id="desktopconnecteurdts" Guid="a-real-guid-here">
<Condition>INSTALLDESKTOPSHORTCUT=1</Condition>
<Shortcut Id="desktopconnecteurdts" Name="DTS eXplorer" WorkingDirectory="ApplicationFolder" Icon="DTSeXplorer.exe" Target="[ApplicationFolder]\DTSeXplorer.exe" Advertise="no" />
</Component>
</Directory>
启动时,安装程序将检查是否存在旧版本,如果发现则删除旧版本:
<Upgrade Id="$(var.UpgradeCode)">
<UpgradeVersion OnlyDetect="no"
Property="PREVIOUSVERSIONSINSTALLED"
Minimum="$(var.OldProductVersion)"
IncludeMinimum="yes"
Maximum="$(var.ProductVersion)"
IncludeMaximum="no"
RemoveFeatures="all" />
<UpgradeVersion OnlyDetect="yes" Property="PROJECT_DOWNGRADE"
Minimum="$(var.ProductVersion)" IncludeMinimum="no" />
</Upgrade>
产品主要版本没有变化,比如我是从1.6.8.12345升级到1.7.2.56789
谢谢!
【问题讨论】:
-
你找到桌面快捷方式的解决方案了吗?
-
@Andreas:位置:不,每次更新都会重置
标签: wix upgrade shortcut shortcut-file