How to get WiX major upgrade working?

前端 未结 3 1979
醉话见心
醉话见心 2020-12-08 01:42

I am struggling to enable the major upgrade functionality in WiX.

I want every new version of the installer to be a major upgrade (full uninstall, then new install)

相关标签:
3条回答
  • 2020-12-08 01:54

    Here's a snippet of what I use for all my packages, refined over many internal and public releases

    <Product Id="*"
             UpgradeCode="$(var.Property_UpgradeCode)"
             Name="!(loc.ApplicationName)"
             Language="!(loc.Property_ProductLanguage)"
             Version="$(var.version)"
             Manufacturer="!(loc.ManufacturerName)" >
    
        <Package Description="!(loc.Package_Description) $(var.version)"
               Comments="!(loc.Package_Comments)"
               Manufacturer="!(loc.ManufacturerName)"
               InstallerVersion="301"
               Compressed="yes"
               InstallPrivileges="elevated"
               InstallScope="perMachine"
               Platform="$(var.ProcessorArchitecture)" />
    
        <Media Id="1" Cabinet="media1.cab" EmbedCab="yes" />
    
        <Upgrade Id="$(var.Property_UpgradeCode)">
            <UpgradeVersion OnlyDetect="yes"
                            Minimum="$(var.version)"
                            Property="NEWERVERSIONDETECTED"
                            IncludeMinimum="no" />
    
            <UpgradeVersion OnlyDetect="no"
                            Maximum="$(var.version)"
                            Property="OLDERVERSIONBEINGUPGRADED"
                            IncludeMaximum="no" />
    
            <!-- Detect for changes in 4th field only -->
            <UpgradeVersion Property="ANOTHERBUILDINSTALLED"
                     Maximum="$(var.version)" Minimum="$(var.version)"
                     IncludeMinimum="yes" IncludeMaximum="yes" OnlyDetect="yes" />
    
        </Upgrade>
    
        <CustomAction Id="CA_BlockOlderVersionInstall" Error="!(loc.LaunchCondition_LaterVersion)" />
        <CustomAction Id="CA_BlockAnotherBuildInstall" Error="!(loc.LaunchCondition_AnotherBuild)" />
    
        <InstallExecuteSequence>
            <Custom Action="CA_BlockOlderVersionInstall" After="FindRelatedProducts">
                <![CDATA[NEWERVERSIONDETECTED]]>
            </Custom>
    
            <!-- Prevent installation on 4th version field change only -->
            <Custom Action="CA_BlockAnotherBuildInstall" After="FindRelatedProducts">
                <![CDATA[ANOTHERBUILDINSTALLED]]>
            </Custom>
    
            <LaunchConditions After="AppSearch" />
    
            <!-- Schedule RemoveExistingProducts early -->
            <RemoveExistingProducts After="InstallInitialize" />
        </InstallExecuteSequence>
    
        <InstallUISequence>
            <Custom Action="CA_BlockOlderVersionInstall" After="FindRelatedProducts">
                <![CDATA[NEWERVERSIONDETECTED]]>
            </Custom>
    
            <!-- Prevent installation on 4th version field change only -->
            <Custom Action="CA_BlockAnotherBuildInstall" After="FindRelatedProducts">
                <![CDATA[ANOTHERBUILDINSTALLED]]>
            </Custom>
    
            <LaunchConditions After="AppSearch" />
        </InstallUISequence>
    
        <!-- .... -->
    
    </Product>
    
    0 讨论(0)
  • 2020-12-08 01:55

    I know this post is old and answered, but, in case anyone runs across this, I had issues with my upgrade installer. The upgrade sections were all fine. The installer would run, but, the previous version was never removed, therefore, the new version was not installed. The issue was this

    <Feature Id="ProductBinaries" Title="ProductBinariesInstaller" Level="0">
    

    The Level="0" above, should have been Level="1" as it is below:

    <Feature Id="ProductBinaries" Title="ProductBinariesInstaller" Level="1">
    

    Scott

    0 讨论(0)
  • 2020-12-08 02:02

    If it's of any use to those who discover this thread, I've also encountered a similar problem which I've just figured out.

    In my case (and still having been in early stages of developing my installer), the critical difference was that, between versions, I had switched from a per-user install to a per-machine install. More specifically, I'd added the following line to my Product.wxs:

    <Property Id='ALLUSERS' Value='1'/>
    

    I'm still getting my head around many of the idiosyncrasies of Windows Installers, but I'd assume that by switching the type of installation in this way would be comparable with shifting to a mutually exclusive stream of versioning in many ways (even enabling two identical versions to be installed in parallel!).

    It's a shame that the Windows Control Panel doesn't clearly distinguish between installations which are per-user and all-users.

    0 讨论(0)
提交回复
热议问题