1

I am trying to add upgrade feature to my wix installer code

This is my Product section

        <?define UpgradeCode = "{8C197FE6-57DF-41FD-A0CD-84B5123123CR}" ?>

        <Product Id="*" 
           Name="!(loc.ProductName_$(var.Platform))"
           Language="!(loc.Language)" 
           Version="$(var.BuildVersion)"
           Manufacturer="!(loc.Company)" 
           UpgradeCode="$(var.UpgradeCode)">

I have below MjaorUpgrade code in Product.wxs

    <MajorUpgrade DowngradeErrorMessage="!(loc.DowngradeErrorMessage)"
                  AllowDowngrades="no" 
                  AllowSameVersionUpgrades="yes" 
                  RemoveFeatures="ALL" 
                  Schedule="afterInstallInitialize"/>

But, when I run the MSI it does not remove the old files and do the fresh install? or it should overwrite the files.

I have filter.xslt as one of the files. Is uninstalling have a dependency on this?

       <?xml version="1.0" encoding="utf-8"?>
        <xsl:stylesheet version="1.0"
            xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
            xmlns:wix="http://schemas.microsoft.com/wix/2006/wi"
            xmlns:util="http://schemas.microsoft.com/wix/UtilExtension">

            <xsl:output method="xml" indent="yes" />

            <xsl:template match="@*|node()">
            <xsl:copy>
            <xsl:apply-templates select="@*|node()"/>
          </xsl:copy>
         </xsl:template>

         <xsl:key name="exe-search" match="wix:Component[contains(wix:File/@Source, 'MyService.exe')]" use="@Id" />

         <xsl:template match="wix:Component[key('exe-search', @Id)]" />
         <xsl:template match="wix:ComponentRef[key('exe-search', @Id)]" />
      </xsl:stylesheet>
kudlatiger
  • 3,028
  • 8
  • 48
  • 98
  • Have you bumped up one of the first 3 digits of the version number? – Stein Åsmul Aug 08 '19 at 23:18
  • Yes. I increased the digit but no luck. What is the difference between Upgrade and MajorUpgrade in simple words? – kudlatiger Aug 09 '19 at 01:14
  • 1
    A minor upgrade is an "in-place" upgrade whereas a major upgrade is an uninstall of the old version and an install of the new one (with various options for sequencing and ordering). In a minor upgrade the product is never uninstalled, there is just a new MSI which installs "on top of" the old one so to speak. Major upgrade is the least error-prone upgrade type, but it has its own flaws typically revolving around unexpected reset or reverting of user data (registry and files). – Stein Åsmul Aug 09 '19 at 01:44
  • 1
    I have to log off for today, but here are two links for you (all I have right now): [Causes of major upgrade failures](https://stackoverflow.com/a/56991527/129130) and the ad-hoc and flawed [how to avoid common design problems in MSI / WIX files](https://stackoverflow.com/q/45840086/129130). And I am too tired to remember if I have sent you [this ad-hoc WiX quick-start answer](https://stackoverflow.com/a/25005864/129130) before. And [some minor upgrade technical restrictions](https://stackoverflow.com/a/51444047/129130). – Stein Åsmul Aug 09 '19 at 01:45
  • Logging the upgrade might provide some new information for why it's not removing some files – Doc Aug 09 '19 at 11:42
  • Try on a clean virtual in case you have a system that is contaminated by development constructs that cause unexpected behavior. – Stein Åsmul Aug 09 '19 at 14:13

0 Answers0