WiX - 如何为所有用户创建卸载快捷方式?

时间:2013-01-30 21:05:30

标签: wix windows-installer shortcuts

这不是问题,而是答案 问题的一部分可以在这里找到:How to install program shortcuts for all users?
报价:
“...如何让安装程序在”所有用户“配置文件下创建快捷方式,以便机器上的每个人都有快捷方式?” 另一个 - 这里:Wix create non advertised shortcut for all users / per machine
报价:
“...在我看过的教程中,使用了快捷键的keypath的注册表值。问题是他们使用HKCU作为根...”

创建卸载快捷方式的主要困难。

该解决方案基于Rob Menching的博客文章How to create an uninstall shortcut (and pass all the ICE validation)

<!-- Script from Rob Menching's blog post -->
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Product Id="PUT-GUID-HERE"
         UpgradeCode="PUT-GUID-HERE"
         Name="TestUinstallShortcut"
         Language="1033"
         Version="1.0.0"
         Manufacturer="Microsoft Corporation"> 

    <Package InstallerVersion="200"
            Compressed="yes"
            InstallScope="perMachine" />

    <Media Id="1" />

    <Directory Id="TARGETDIR"
               Name="SourceDir">
        <Directory Id="ProgramMenuFolder">
            <Directory Id="ShortcutFolder"
                       Name="My Application">
                <Component Id="UninstallShortcutComponent"
                           Guid="PUT-GUID-HERE">
                    <RegistryKey Root="HKCU"
                                 Key="Software\[UpgradeCode]">
                        <RegistryValue Value="RobMen Was Here."
                                       Type="string"
                                       KeyPath="yes" />
                    </RegistryKey>

                    <Shortcut Id="UninstallProduct"
                              Name="Uninstall My Application"
                              Target="[System64Folder]msiexec.exe"
                              Arguments="/x [ProductCode]"
                              Directory="ShortcutFolder"
                              Description="Uninstalls My Application" />

                    <RemoveFolder Id="RemoveShorcutFolder"
                                  On="uninstall" />
                </Component>
            </Directory>
        </Directory>
    </Directory>

    <Feature Id="TestUninstallShortcut"
             Title="Test Uninstall Shortcut Feature"
             Level="1">
        <ComponentRef Id="UninstallShortcutComponent" />
    </Feature>
    <CustomAction Id="LaunchApp" 
                  Directory="TARGETDIR" 
                  ExeCommand="[System64Folder]reg.exe Delete HKCU\Software\[UpgradeCode] /f" />
    <InstallExecuteSequence>
        <Custom Action="LaunchApp" 
                After="InstallFinalize">(NOT Installed) OR UPGRADINGPRODUCTCODE</Custom>
    </InstallExecuteSequence>
</Product>
</Wix>  

在这个例子中:
在“套餐”项中添加了InstallScope ="perMachine"
将注册表项更改为"Software\[UpgradeCode]"
添加了CustomAction LaunchApp以删除不需要的注册表项。

在WinXP 32位和Win7 64位上测试。

0 个答案:

没有答案