无法删除以前版本的 MSI.控制面板中显示多个条目 [英] Unable to remove previous versions of MSI. Multiple entry's show up in control panel

查看:51
本文介绍了无法删除以前版本的 MSI.控制面板中显示多个条目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不确定我是否遗漏了什么,或者我只是愚蠢,我遇到的问题与卸载 MSI 相关.基本上我正在构建一个应用程序,并使用 WIX 创建 MSI 安装程序.发生的情况是我能够安装该应用程序的先前版本,但无法升级到较新版本的 MSI.例如,当我单击/安装较新版本的 MSI 和较旧的 MSI 时,两个 MSI 都将安装并在控制面板中可见(MyApp 1.5.0、MyApp 1.6.0).

I am not sure if i am missing something or i just plain dumb, the issue i am having related to uninstalling a MSI. Basically i am building a app, and using WIX to create the MSI installer. What is happening is that i am able to install a previous version of the app but not upgrade to a newer version MSI. E.g, when i click/install the newer version MSI then the older MSI, both MSI will be installed and visible in control panel(MyApp 1.5.0, MyApp 1.6.0).

我很确定我已经正确配置了MINORUPGRADE/MAJORUPGRADE"和 RemoveExistingProducts Action,但这个问题仍然发生.

I am pretty sure i have the "MINORUPGRADE/MAJORUPGRADE" along with the RemoveExistingProducts Action configured properly but this issue still happens.

我尝试修改 MINORUPGRADE/MAJORUPGRADE 值和 RemoveExistingProducts 属性,但仍然得到相同的行为.

I tried modifying the MINORUPGRADE/MAJORUPGRADE values and the RemoveExistingProducts property but still get the same behavior.

我的 WIX 配置看起来像这样(没有目录/路径...)

My WIX config looks like this (without the Directory/paths...)

<?xml version="1.0" encoding="utf-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi" xmlns:util="http://schemas.microsoft.com/wix/UtilExtension">
  <Product Id="*" Language="1033" Manufacturer="MyApp" Name="MyApp $(env.APP_BASE_VERSION)" UpgradeCode="$(env.UPGRADE_CODE)"
    Version="$(env.APP_BASE_VERSION)">
    <Package Compressed="yes" InstallerVersion="200" InstallScope="perMachine" InstallPrivileges="elevated" Description="MyApp $(env.APP_VERSION) Installer"
      Comments="" Manufacturer="MyApp" />

    <Property Id="MsiLogging" Value="v!" />
    <MediaTemplate EmbedCab="yes" CompressionLevel="$(env.COMPRESSION_LEVEL)"/>
    <Icon Id="icon.ico" SourceFile="$(env.STATIC_RESOURCE_PATH)\icon.ico" />
    <Property Id="ARPPRODUCTICON" Value="icon.ico" />

    <Upgrade Id="$(env.UPGRADE_CODE)">
      <UpgradeVersion 
          Property="MAJORUPGRADE" 
          Minimum="0.0.0.0" 
          IncludeMinimum="yes" 
          Maximum="$(env.APP_BASE_VERSION)" 
          IncludeMaximum="no" 
          IgnoreRemoveFailure="no" 
          MigrateFeatures="yes" /> 
        <UpgradeVersion 
          Property="MINORUPGRADE" 
          Maximum="$(env.APP_BASE_VERSION)" 
          Minimum="$(env.APP_BASE_VERSION)" 
          IncludeMinimum="yes" 
          IncludeMaximum="yes" 
          /> 

    </Upgrade>  


    ...

    <CustomAction Id="Remove_Roaming_MyApp" Directory="TARGETDIR" ExeCommand="cmd.exe /C &quot;rmdir /s /q &quot;[AppDataFolder]\MyApp&quot;&quot;" Execute="deferred" Return="ignore" HideTarget="yes" Impersonate="no" />

    <Property Id="WixShellExecTarget" Value="[#MyAppEXE]" />
    <CustomAction Id="LaunchApplication" BinaryKey="WixCA" DllEntry="WixShellExec" Impersonate="yes" />

    <util:CloseApplication Id="CloseApp"  Target="MyApp.exe" RebootPrompt="no" CloseMessage="yes"/>

    <CustomAction Id="Kill_MyApp_instances"
      Directory="TARGETDIR" 
      ExeCommand="taskkill.exe /IM MyApp.exe /F"
      Execute="deferred" 
      Return="ignore" HideTarget="yes" Impersonate="no" />

    <!-- This will create a log in the Temp folder of the user profile by default. NOTE: this is not the full log! The MSI will need to be ran with `/l*v <destination file>` -->
    <CustomAction Id="CopyLog_partial"
      ExeCommand="cmd /c copy &quot;[MsiLogFileLocation]&quot; &quot;%SystemDrive%\Windows\Temp\MyApp-msi.log&quot;" 
      Directory="TARGETDIR" 
      Impersonate="no" 
      Execute="commit" 
      Return="ignore" />
    <CustomAction Id="CopyLog_full"
      ExeCommand="cmd /c copy &quot;[MsiLogFileLocation]&quot; &quot;[LocalAppDataFolder]\Temp\MyApp-msi.log&quot;" 
      Directory="TARGETDIR" 
      Impersonate="no" 
      Execute="immediate" 
      Return="ignore" />
    <InstallExecuteSequence>

      <RemoveExistingProducts Before="InstallValidate" />
      <Custom Action="WixCloseApplications" Before="InstallValidate" /> 
      <Custom Action="Kill_MyApp_instances" After='InstallInitialize'></Custom>
      <Custom Action="LaunchApplication" After='InstallFinalize'>NOT Installed</Custom>

      <Custom Action="CopyLog_partial" After="PublishProduct" /> 
      <Custom Action="CopyLog_full" OnExit="success" />
    </InstallExecuteSequence>

    <Feature Id="ProductFeature" Title="SetupProject1" Level="1">
      <ComponentGroupRef Id="ELECTRON_FRAGMENTS"/> 
      <ComponentRef Id="Remove_MyApp_Roaming_comp" />
      <ComponentRef Id="Remove_uninstallCache_folder" />
      <ComponentRef Id="Remove_MyApp_programFiles_comp" />
      <ComponentRef Id="Shortcut_startMenu" />
    </Feature>

  </Product>
</Wix>

预期的行为是删除以前的 MSI 或更好的在 MSI 安装过程中安装的所有版本.我知道这可以通过 CustomAction 来完成,但我想知道是否有更优雅的方法来做到这一点?

The intended behavior is to remove the previous MSI or better yet all versions installed during the installation process of the MSI. I know this can be done with a CustomAction but i was wondering if theres a more elegant way to do this?

推荐答案

总结:当您在添加/删除程序中获得两个条目时,主要升级失败.我建议你注释掉所有重大升级构造并尝试用最简单的构造获得心跳可用 - 解释如下.

Summary: When you get two entries in Add / Remove Programs the major upgrade has failed. I suggest you comment out all major upgrade constructs and try to get a heartbeat with the simplest constructs available - explained below.

<小时>

主要升级:您使用旧的构造来实现您的主要升级.有一种更新更简单的方法,就像这样:


Major Upgrade: You have used old constructs to implement your major upgrade. There is a newer and simple way, like this:

<MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />

这有点像一个模板",通过使用普通选项"或您喜欢的简化选项,以最少的模糊量实现主要升级.使用此模板时无需添加自己的 RemoveExistingProducts 条目,实际上这可能会在编译时产生重复条目/符号":

This is sort of like a "template" implementing the major upgrade with the least amount of fuzz by just using "normal options" or simplified options if you like. There is no need to add your own RemoveExistingProducts entry when you use this template, in fact that will probably yield a "duplicate entry / symbol" on compile:

  • 添加上面的 MajorUpgrade 元素.
  • 注释掉整个Upgrade 元素.
  • 注释掉 RemoveExistingProducts 元素.

较旧的构造:MajorUpgrade 元素 足以实现有效的主要升级,但您可以仍然使用旧的 WiX 结构(UpgradeUpgradeVersion 元素)以获得对创作的更细粒度的控制升级表.正是该表定义了如何处理现有安装.升级表通过匹配升级代码识别相关产品,然后执行在 升级表本身.

Older Constructs: The MajorUpgrade element will be enough to implement a working major upgrade, but you can still use the old WiX constructs (Upgrade and UpgradeVersion elements) to obtain more fine-grained control of the authoring of the Upgrade table. It is this table which defines how existing installations are to be handled. The upgrade table identifies related products by matching upgrade codes and then performs whatever action is defined for that scenario in the Upgrade table itself.

以前的答案:关于这个主题有几个较旧的答案,请参阅以下内容:

Previous Answers: There are several older answers on this topic, please see the following:

更多链接:

更新:

这篇关于无法删除以前版本的 MSI.控制面板中显示多个条目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆