【问题标题】:WIX-Setup Uninstall old versionWIX-Setup 卸载旧版本
【发布时间】:2013-01-09 07:15:55
【问题描述】:

我从 VS2010 升级到 VS2012。 我有一个带有设置的客户端应用程序。我使用 Windows-Installer 来创建设置。 现在我想升级我的项目并且遇到 VS2012 不再支持 Windows-Installer 的问题。 我尝试使用 WIX 创建一个新设置。 这是我的新设置文件:

<?xml version="1.0" encoding="UTF-8"?>
 <Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Product Id="FADB7F3E-0E92-494E-B627-930BC217DE29" Name="SMC" Language="1033" Version="1.1.1"
       Manufacturer="abc" UpgradeCode="1BC520F0-F6CB-4E70-8F7B-9F398BE4F25B">
<Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" />
<!--<MajorUpgrade Schedule="afterInstallInitialize" DowngradeErrorMessage="A newer version of [ProductName] is already installed." />-->
<MediaTemplate />


<Upgrade Id="1BC520F0-F6CB-4E70-8F7B-9F398BE4F25B">
  <!--<UpgradeVersion Minimum="1.1.1.0" IncludeMinimum="no" OnlyDetect="no" Property="NEWERVERSIONDETECTED" />-->
  <UpgradeVersion Minimum="0.0.0.0" Maximum="1.1.1.0" IncludeMinimum="yes" IncludeMaximum="yes" Property="OLDERVERSIONBEINGUPGRADED" />
</Upgrade>

<InstallExecuteSequence>
  <RemoveExistingProducts After="InstallFinalize" />
  <Custom Action="NewerVersion" After="FindRelatedProducts">NEWERVERSIONDETECTED</Custom>
</InstallExecuteSequence>

<CustomAction Id="NewerVersion" Error="A later version of [ProductName] is already installed." />


<!--<Fragment>-->
<Directory Id="TARGETDIR" Name="SourceDir">
  <Directory Id="ProgramFilesFolder">
    <Directory Id="INSTALLFOLDER" Name="abc">
      <Directory Id="PROGFOLDER" Name="SMC">
        <Directory Id="IMAGES" Name="images"/>
        <Directory Id="CULTURE" Name="de-DE" />
      </Directory>
    </Directory>
    <Directory Id="ProgramMenuFolder">
      <Directory Id="SMC_Shortcut" Name="abc">
      </Directory>
    </Directory>
  </Directory>
</Directory>
<!--</Fragment>-->

<!--<Fragment>-->
<DirectoryRef Id="IMAGES">
  <Component Id="Image" Guid="82BB42E8-AD7A-4E62-B5B7-37C7EA2DFC8D">
    <File Id="Program_Icon" Source="C:\Projects\SMC\Dev\SMC\images\SMC.ico" KeyPath="yes" Checksum="yes" />
  </Component>
</DirectoryRef>
<DirectoryRef Id="CULTURE">
  <Component Id="Lang" Guid="109183AC-3F37-4BDC-B659-38C12CE4BAD3">
    <File Id="Language" Source="C:\Projects\SMC\Dev\Culture\bin\Release\de-DE\Culture.resources.dll" KeyPath="yes" Checksum="yes" />
  </Component>
</DirectoryRef>
<DirectoryRef Id="PROGFOLDER">
  <Component Id="Dll_Culture" Guid="AC8103CF-FDFB-4792-BF84-577F27A3CC1B">
    <File Id="culture_dll" Source="C:\Projects\SMC\Dev\Culture\bin\Release\Culture.dll" KeyPath="yes" Checksum="yes" />
  </Component>
  <Component Id="Dll_Helper" Guid="33DEC912-AF34-4473-8E6D-E36D07B644B1">
    <File Id="helper_dll" Source="C:\Projects\SMC\Dev\Helper\bin\Release\Helper.dll" KeyPath="yes" Checksum="yes" />
  </Component>
  <Component Id="Dll_Secman" Guid="9E543EF7-5205-49F2-9B2A-52D0D469781D">
    <File Id="secman_dll" Source="C:\Projects\SMC\Tools\secman.dll" KeyPath="yes" Checksum="yes" />
  </Component>
  <Component Id="Dll_SecurityManager" Guid="AF80A4B2-3B5F-4CA9-B357-65AC9031CFF3">
    <File Id="securityManager_2005_dll" Source="C:\Projects\SMC\Tools\SecurityManager.2005.dll" KeyPath="yes" Checksum="yes" />
  </Component>
  <Component Id="Dll_UDDI" Guid="35EFC304-EB62-4EB4-A1F4-4D0E0AE56A76">
    <File Id="uddiConnect_dll" Source="C:\Projects\SMC\Tools\abc.UddiConnectLib.dll" KeyPath="yes" Checksum="yes" />
  </Component>
  <Component Id="Exe_SMC" Guid="48FF7F56-D4E1-4CE6-B333-8F8BF73B6D58">
    <File Id="exe_file" Source="C:\Projects\SMC\Dev\SMC\bin\Release\SMC.exe" KeyPath="yes" Checksum="yes" />
  </Component>
  <Component Id="Exe_SMC.config" Guid="865139C6-740A-499B-8C0E-FAF163A4A98F">
    <File Id="exe_file.config" Source="C:\Projects\SMC\Dev\SMC\bin\Release\SMC.exe.config" KeyPath="yes" Checksum="yes" />
  </Component>
</DirectoryRef>
<DirectoryRef Id="SMC_Shortcut">
  <Component Id="shortcut" Guid="46E8006D-9A0A-4086-94AE-A002F6C5B4D7">
    <Shortcut Id="SMC_abc" Name="SMC" Description="SMC"
              Target="[PROGFOLDER]SMC.exe" Icon="SMC_Icon" Arguments="prod">
      <Icon Id="SMC_Icon" SourceFile="C:\Projects\SMC\Dev\SMC\images\SMC.ico" />
    </Shortcut>
    <RegistryValue Root="HKMU" Key="Software\Microsoft\Windows\CurrentVersion\Run" Name="SMC"
                   Type="string" Value="[PROGFOLDER]SMC.exe prod" KeyPath="yes" />
    <RemoveFile Id="SMC_abc" Name="SMC" On="uninstall" />
  </Component>
</DirectoryRef>
<ComponentGroup Id="ProductComponents" Directory="INSTALLFOLDER">
  <ComponentRef Id="Image" />
  <ComponentRef Id="Lang" />
  <ComponentRef Id="Dll_Culture" />
  <ComponentRef Id="Dll_Helper" />
  <ComponentRef Id="Dll_Secman" />
  <ComponentRef Id="Dll_SecurityManager" />
  <ComponentRef Id="Dll_UDDI" />
  <ComponentRef Id="Exe_SMC" />
  <ComponentRef Id="Exe_SMC.config" />
  <ComponentRef Id="shortcut" />
</ComponentGroup>

<!--</Fragment>-->

<Feature Id="ProductFeature" Title="SMC.SetupTest" Level="1">
  <ComponentGroupRef Id="ProductComponents" />
</Feature>
<Property Id="ARPPRODUCTICON">RemoveIcon</Property>
<Icon Id="RemoveIcon" SourceFile="C:\Projects\SMC\Dev\SMC\images\SMC.ico" />


<CustomAction Id="OurAction" FileKey="exe_file" ExeCommand="prod" Execute="immediate" Return="asyncNoWait" />

它会安装新版本,但不会卸载旧版本。 旧程序仍然出现在控制面板的程序和功能中。 如何删除此版本。

我尝试使用两个版本的 Wix-Setup 进行安装。 当我尝试安装较新版本时,它会显示一个带有以下消息的消息框: 已安装此软件的另一个版本...

有人可以帮我吗?

【问题讨论】:

  • 原始安装程序的 GUID 是否列在新安装程序的升级表中?
  • UpgradeCode 和 Upgrade-ID 应该是一样的吧?这个 GUID 应该是之前包的 GUID。
  • @user2010590 - GUID 应该是之前包的升级 ID,而不是包 ID。
  • 以前在哪里可以找到包的Upgrade-ID?我还有微星。
  • 获取 Orca(如果您还没有) - 它可以让您浏览 MSI 的表格。这是 MS 提供的免费工具。

标签: .net installation wix


【解决方案1】:

你可以做到这一点是几个步骤:

  1. 使用 Orca 打开您拥有的旧 MSI。
  2. 转到属性表并找到UpgradeCode 属性
  3. 复制 UpgradeCode 属性的 GUID 值。
  4. 在 .wxs 文件中为 Product/@UpgradeCode 属性使用该 GUID。相同的 GUID 将新 MSI 与旧 MSI 关联起来。
  5. 将 .wxs 文件中的 Upgrade 元素替换为 MajorUpgrade 元素。
  6. DowngradeErrorMessage 添加到 MajorUpgrade 元素,并在已安装较新版本的情况下尝试安装旧 MSI 时显示消息。

现在您的升级应该可以工作了。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-06-03
    • 1970-01-01
    • 2013-02-17
    • 2011-08-19
    • 1970-01-01
    • 2011-08-27
    相关资源
    最近更新 更多