模式进行wix升级而不会弄乱用户的桌面图标

Séb*_*mer 5 wix upgrade shortcut desktop-shortcut

我正在研究的Wix设置询问用户是否从桌面上的主程序安装shorcut.

问题是在升级过程中,删除了快捷方式,然后重新创建:

  • 如果用户移动了图标,则可能会在其他位置重新创建(从左上角开始的下一个可用空间)
  • 如果用户在初始安装期间选择不创建图标,则使用UI升级时不会记住默认情况下创建图标的复选框应"未选中",而静默升级只会创建图标,尽管用户明确选择不具有这个图标已创建.

有没有一种简单的方法来妥善处理这种情况?

以下是我的wix设置的信息:

每台机器安装

用户选择通过在"选择目标"的修改版本上添加的复选框来安装桌面快捷方式:

<Control Id="DesktopShortcutCheckBox" Type="CheckBox" X="20" Y="160" Width="290" Height="17" Property="INSTALLDESKTOPSHORTCUT" CheckBoxValue="[INSTALLDESKTOPSHORTCUT]" Text="!(loc.InstallDirDlgCreateDesktopShortcut)" />
Run Code Online (Sandbox Code Playgroud)

在UI标记中,我初始化了属性:

<Property Id="INSTALLDESKTOPSHORTCUT" Value="1"/>
Run Code Online (Sandbox Code Playgroud)

这是使用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>
Run Code Online (Sandbox Code Playgroud)

启动后,安装程序将检查是否存在旧版本,如果找到则删除旧版本:

<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>
Run Code Online (Sandbox Code Playgroud)

产品版本major不会改变,例如我从1.6.8.12345升级到1.7.2.56789

谢谢 !

Bry*_*anJ 1

在安装过程中将 INSTALLDDESKTOPSHORTCUT 的值写入注册表。每当安装程序启动时,您都可以读取注册表,如果该注册表项存在,请将其设置为该属性的默认值。

但不确定您是否可以对桌面上快捷方式的位置进行任何操作。