0

I am developing a wix installer. This wix installer installs a 3rdparty msipackage.

I want my wix bootstrapper project to install this msipackage no matter what version that should already exist on the users pc. This means that if the same version(or a newer version) exists it should overwrite that installation.

I install my msipackage like this:

<MsiPackage Id="InstacalFull" Name="Measurement Computing InstaCal" Vital="yes" Compressed="yes" SourceFile="../Suite.SetupBootstrapper/3rdparty/Instacal/InstaCal.msi">

Does anyone have any ideas on how to achieve this?

Siguza
  • 21,155
  • 6
  • 52
  • 89
Diemauerdk
  • 5,238
  • 9
  • 40
  • 56
  • 1
    I suspect this may not be possible unless the bootstrapper is smart, and maybe it is. Typically, atempting to install a lower version than is on the system fails with "higher version already exists"; installjng the same version results in a repair.; installing a higher version requires that MSI to have upgrade logic. If any of these are an issue you'd need to detect if it's already installed and unstall it first. – PhilDW Apr 30 '15 at 22:54
  • I hope the users are agreeable to your actions as this has the potential to break other applications in unforeseen ways. – Tom Blodget May 02 '15 at 21:21

2 Answers2

0

Use InstallCondition="1"

This will install it every time

http://wixtoolset.org/documentation/manual/v3/xsd/wix/msipackage.html

InstallCondition

String
A condition to evaluate before installing the package. The package will only be installed if the condition evaluates to true. If the condition evaluates to false and the bundle is being installed, repaired, or modified, the package will be uninstalled.

tollgen
  • 209
  • 1
  • 4
  • 15
  • no, this will not work, as it will only 'allow' installation, but if package is already installed this condition will be ignored. – MarcusUA Oct 12 '17 at 17:21
0

I know this one is old, but since I came across this issue, maybe it would help someone, too.

In my case Repair was enough, so although technically it wasn't reinstall, practically Repair = Reinstall. I needed to reinstall URLrewrite, because it could get broken when IIS Windows feature was disabled.

What you need it to add custom handler for PlanPackageBegin in you custom BootstrapperApplication class, for example:

CustomBootstrapperApplication.Model.Bootstrapper.PlanPackageBegin += this.PlanPackageBegin;
...........

private void PlanPackageBegin(object sender, PlanPackageBeginEventArgs e)
{
    if (e.PackageId.ToLower().Contains("urlrewrite"))
    {
        if (CustomBootstrapperApplication.Model.Command.Action != LaunchAction.Uninstall && e.State == RequestState.Present)
        {
            CustomBootstrapperApplication.Model.Engine.Log(LogLevel.Verbose, string.Format("{0} is installed, forcing Repair", e.PackageId));
            e.State = RequestState.Repair;
        }
    }

    _packageList.Add(e.PackageId, e.State);
}

And in the the Bundle:

<!-- Note: this Id is used in PlanPackageBegin -->
<MsiPackage Id='urlrewrite2X64' Vital='no'
      Permanent='yes'
      SourceFile="rewrite_amd64.msi"
      DownloadUrl="http://example.com/rewrite_amd64.msi"
      DisplayInternalUI="no"
      Visible="yes"
      InstallCondition="VersionNT64"/>

You can force uninstallation of previous MSI during upgrade by something like this inside PlanPackageBegin:

if (LaunchAction.Uninstall == CustomBootstrapperApplication.Model.Command.Action && (CustomBootstrapperApplication.Model.Command.Relation == RelationType.Upgrade))
{
    e.State = RequestState.None;
}
MarcusUA
  • 394
  • 3
  • 14