2012-04-12 84 views
4

我正在工作的Wix安裝程序詢問用戶是否在桌面上安裝主程序的shorcut。模式做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

謝謝!

+0

您是否找到桌面快捷方式的解決方案? – Andreas 2014-08-14 08:22:25

+0

@Andreas:對於位置:沒有它在每個更新 – 2014-08-14 16:39:11

回答

1

在安裝過程中將INSTALLDESKTOPSHORTCUT的值寫入註冊表。無論何時安裝程序啓動,您都可以讀取註冊表,如果該鍵存在,請將其設置爲該屬性的默認值。

不知道您是否可以對桌面上的快捷方式的位置做任何事情。

+0

這是我認爲,我正在尋找更簡單的東西,雖然(內置也許)... – 2012-04-13 06:43:29

+0

無法做任何'布特的快捷方式的位置,但去了註冊表記住複選框狀態的路線。我建議以下閱讀提供涵蓋所有情況的解決方案:http://robmensching.com/blog/posts/2010/5/2/The-WiX-toolsets-Remember-Property-pattern – 2012-04-16 07:51:02

0

您只能使用wix保存和恢復快捷方式的設置。

你的財產必須是這樣的。

<Property Id="INSTALLDESKTOPSHORTCUT" Value="1" Secure="yes"> 
    <RegistrySearch Id="Reg64" Root="HKLM" Win64="yes" Key="Software\$(var.ProductCompany)" Name="CreateDesktopShortcut" Type="raw"></RegistrySearch> 
    <RegistrySearch Id="Reg32" Root="HKLM" Win64="no" Key="Software\$(var.ProductCompany)" Name="CreateDesktopShortcut" Type="raw"></RegistrySearch> 
</Property> 

兩個「RegistrySearch的只存在既包括32位和64位安裝,如果你只使用32位,你可以刪除其中的一個。

並在您的根文件夾下添加此項。

<Component Permanent="yes" Id="RegistryEntries" Guid="YOUR_GUID"> 
    <RegistryKey Root="HKLM" Key="Software\$(var.ProductCompany)" Action="create"> 
    <RegistryValue Type="integer" Name="CreateDesktopShortcut" Value="[INSTALLDESKTOPSHORTCUT]" /> 
    </RegistryKey> 
</Component>