卸载wix安装程序似乎进行修复而不是卸载

时间:2015-04-16 07:27:12

标签: wix

我有一个使用wix生成安装包的项目。安装工作正常,但当一个人试图卸载项目时,一切看起来都不错 - 但在unistall完成后,产品仍然存在(仍在运行)。添加/删除程序中的条目从那里卸载时消失,但在刷新后返回(F5)。测试人员发现一切看起来像卸载实际上都在修复。

我们做错了什么(项目否则只生成更多的组件片段文件" heat"(在wixproj中有HeatDirectory-Entries),并定义了一些预处理器变量)?

这是product.wxs。对不起,我知道这很多代码,但我不知道我能安全地省略什么来找到问题......:

<?xml version="1.0" encoding="UTF-8"?>
<?define ProductVersion=1.1.0.0?>
<?define UpgradeCode=$(var.UpdateCode)?>
<?define ProductName=$(var.PV) Name?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
    <Product Id="*" Name="$(var.ProductName)" Language="1033" Version="$(var.ProductVersion)" Manufacturer="xyz" UpgradeCode="$(var.UpgradeCode)">
        <Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" InstallPrivileges="elevated" />

    <SetProperty Id="REINSTALL" Value="ALL" After="FindRelatedProducts" >Installed AND Remove&lt;&gt;"ALL"</SetProperty>
    <SetProperty Id="REINSTALLMODE" Value="vamus" After="FindRelatedProducts">Installed AND Remove&lt;&gt;"ALL"</SetProperty>

    <MajorUpgrade DowngradeErrorMessage="A newer version of $(var.ProductName) is already installed." />
    <MediaTemplate EmbedCab="yes" />

    <Feature Id="ProductFeature" Title="XY Installer" Level="1" ConfigurableDirectory="INSTALLLOCATION">
            <ComponentGroupRef Id="ProductComponents" />
      <ComponentGroupRef Id="DesktopShortcutComponentGroup"/>
      <ComponentGroupRef Id="StartmenuShortcuts"/>
        </Feature>

    <CustomAction Id="RestoreDatabase" Directory="INSTALLLOCATION" ExeCommand="[INSTALLLOCATION]initial_db\BURestore.exe $(var.Sport)_$(var.Project) D:\$(var.Sport)\initial_db\db.bak" Execute="deferred" Return="ignore" HideTarget="no" Impersonate="no" />
    <CustomAction Id="RenameFormatFilesFolder" Directory="LISTTOOLLOCATION" ExeCommand="cmd /c &quot;mv FormatFiles fmt&quot;" Return="ignore" Impersonate="yes"></CustomAction>
    <InstallExecuteSequence>
      <Custom Action="RestoreDatabase" Before="InstallFinalize">NOT REMOVE</Custom>
      <Custom Action="RenameFormatFilesFolder" After="InstallFinalize">NOT REMOVE</Custom>
    </InstallExecuteSequence>
    <Property Id="WIXUI_INSTALLDIR" Value="INSTALLLOCATION"/>
    <UI>
      <UIRef Id="WixUI_InstallDir"/>
      <Publish Dialog="WelcomeDlg" Control="Next" Event="NewDialog" Value="InstallDirDlg" Order="2">1</Publish>
      <Publish Dialog="InstallDirDlg" Control="Back" Event="NewDialog" Value="WelcomeDlg" Order="2">1</Publish>
    </UI>
  </Product>

    <Fragment>
    <Directory Id="TARGETDIR" Name="SourceDir">
      <Directory Id="ROOTDIR" Name="D"/>
      <Directory Id="INSTALLLOCATION" Name="$(var.PV)">
        <Directory Id="CONF" Name="conf">
          <Directory Id="LISTTOOLLOCATION" Name="PRINT"></Directory>
        </Directory>
      </Directory>
      <Directory Id="DesktopFolder" />
      <Directory Id="ProgramMenuFolder">
        <Directory Id="ProgramMenuSubfolder" Name="ST">
          <Directory Id="ApplicationFolder" Name="$(var.ProductName)" />
        </Directory>
      </Directory>
        </Directory>
    </Fragment>

    <Fragment>
        <ComponentGroup Id="ProductComponents" Directory="INSTALLLOCATION">
        <ComponentGroupRef Id="RootFiles" />
        <ComponentGroupRef Id="ListToolFiles" />
        <ComponentGroupRef Id="inis" />
        </ComponentGroup>
    <ComponentGroup Id="DesktopShortcutComponentGroup">
      <Component Id="DesktopShortcutComponent" Guid="{C54B....}" Directory="DesktopFolder">
        <Shortcut Id="ApplicationDesktopShortcut"
           Name="$(var.ProductName)"
           Description="$(var.ProductName) Application"
           Target="[INSTALLLOCATION]RO.exe"
           WorkingDirectory="INSTALLLOCATION"/>
        <RemoveFolder Id="DesktopFolder" On="uninstall"/>
        <RegistryValue Root="HKCU" Key="Software\ST\$(var.ProductName)" Name="installed" Type="integer" Value="1" KeyPath="yes"/>
      </Component>
    </ComponentGroup>
    <ComponentGroup Id="StartmenuShortcuts" Directory="ApplicationFolder">
      <Component Id="StartmenuShortcutComp" Guid="{ACD9...}">
        <Shortcut Id="StartmenuShortcut" Name="$(var.ProductName)" Description="$(var.ProductName) Application" Target="[INSTALLLOCATION]RO.exe" WorkingDirectory="INSTALLLOCATION" />
        <Shortcut Id="UninstallProduct"  Name="Uninstall $(var.ProductName)" Target="[SystemFolder]msiexec.exe" Arguments="/x [ProductCode]" Description="Uninstalls $(var.ProductName)" />
        <RemoveFolder Id="RemoveProgramMenuSubfolder" Directory="ProgramMenuSubfolder" On="uninstall"/>
        <RemoveFolder Id="RemoveApplicationFolder" Directory="ApplicationFolder" On="uninstall"/>
        <RegistryValue Root="HKCU" Key="Software\ST\$(var.ProductName)" Name="installed" Type="integer" Value="1" KeyPath="yes"/>
      </Component>
    </ComponentGroup>
    </Fragment>
</Wix>

1 个答案:

答案 0 :(得分:0)

以下两行正在解决这个问题。

<SetProperty Id="REINSTALL" Value="ALL" After="FindRelatedProducts" >Installed AND Remove&lt;&gt;"ALL"</SetProperty>
<SetProperty Id="REINSTALLMODE" Value="vamus" After="FindRelatedProducts">Installed AND Remove&lt;&gt;"ALL"</SetProperty>

该条件成立,因为在安装执行序列中的InstallValidate操作之后,卸载将在卸载中设置为ALL。请查看以下链接了解更多详情。

https://msdn.microsoft.com/en-us/library/aa368013(v=vs.85).aspx