2
votes

I'm using WiX toolset v3.7 and Visual Studio 2013 to create an installer package for an Excel plugin.

The plugin depends on .NET Framework 4.5 and I'd like the installer to automatically detect whether the required framework exists on the target machine and if not, install it.

Googling got me to this page: http://wix.sourceforge.net/manual-wix3/install_dotnet.htm, but the link to instructions on how to create a Bundle is broken on that page.

I've tried adding the element to my root element but end up with errors. I've also tried a few examples I've found on the web but none of them seem to work properly with the default WiX manifest that was generated for me during project creation in VS2013.

What do I need to add to my manifest to enable automatic installation of .NET Framework 4.5?

I'd greatly appreciate any help here! My manifest is shown below:

<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">

  <Product Id="*" Name="Awesome Excel Add-in 1.0" Language="1033" Version="1.0" Manufacturer="Farhan Ahmed" UpgradeCode="7ffd5a6d-d38e-4d6b-b554-098d95791222">

    <Package Description="Awesome Excel Add-in Installer" InstallerVersion="200" Compressed="yes" InstallScope="perMachine" />

    <Condition Message="You need to be an administrator to install this product.">
      Privileged
    </Condition>

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

    <Feature Id="ProductFeature" Title="AwesomeExcelSetup" Level="1">
      <ComponentGroupRef Id="ProductComponents" />
    </Feature>

    <CustomAction Id='LaunchInstallerFile' FileKey='fAddinInstaller' ExeCommand='/I /64' Return='asyncWait' />
    <CustomAction Id='LaunchRemoverFile' FileKey='fAddinInstaller' ExeCommand='/U' Return='check' />

    <InstallExecuteSequence>
      <Custom Action='LaunchInstallerFile' After='InstallFinalize'>NOT Installed</Custom>
      <Custom Action='LaunchRemoverFile' Before='RemoveFiles'>Installed AND NOT REINSTALL</Custom>
    </InstallExecuteSequence>

    <UI>
      <UIRef Id="WixUI_Minimal" />
    </UI>

    <Icon Id="icon.ico" SourceFile="$(var.AwesomeExcelAddin.TargetDir)\Awesome.ico"/>
    <Property Id="ARPPRODUCTICON" Value="icon.ico" />

  </Product>

  <Fragment>
    <Directory Id="TARGETDIR" Name="SourceDir">
      <Directory Id="ProgramFilesFolder" Name="PFiles">
        <Directory Id="INSTALLPARENT" Name="Awesome" >
          <Directory Id="INSTALLFOLDER" Name="Excel Add-in 1.0" />
        </Directory>
      </Directory>
    </Directory>
  </Fragment>

  <Fragment>
    <ComponentGroup Id="ProductComponents" Directory="INSTALLFOLDER">
      <Component Id="ProductComponent" Guid="DDD3F332-0DF1-47F0-B8D0-5E1E09BF69BE">
        <File Id="f32bitXLL" Source="$(var.AwesomeExcelAddin.TargetDir)\AwesomeAddinPacked32.xll" />
        <File Id="f64bitXLL" Source="$(var.AwesomeExcelAddin.TargetDir)\AwesomeAddinPacked64.xll" />
        <File Id="fAddinDll" Source="$(var.AwesomeExcelAddin.TargetDir)\AwesomeExcelAddin.dll" />
        <File Id="fAddinInstaller" Source="$(var.AwesomeExcelAddinInstaller.TargetDir)\AwesomeExcelAddinInstaller.exe" />
      </Component>
    </ComponentGroup>
  </Fragment>
</Wix>
1
That's right some of the URLs are missing /manual-wix3, like this.Tom Blodget
You'll need to create two wix projects for this, one for your plugin and one for the bundle (which will use burn). Also, protip: use one file per component, it saves a lot of headaches when it comes to following the component rules.Netfangled

1 Answers

1
votes

Thanks to the comment by Netfangled, I was able to move forward.

Like he (she?) mentioned, the trick was to create another project for the Bootstrapper and then reference the .NET Fx and the MSI in that manifest.

Although I did run into a "environment variable not defined" issue, I was able to work around the problem by specifying a source file using the Solution directory as the base.

Here's the new manifest:

<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
    <Bundle Name="Awesome Excel Plugin Setup" Version="1.0.0.0" Manufacturer="Awesome Software" UpgradeCode="1f605e3b-2954-403c-b9cb-ca1f0e8bf65b">

    <WixVariable Id="WixStdbaLogo" Value="Logo.png" />

    <BootstrapperApplicationRef Id="WixStandardBootstrapperApplication.RtfLicense" />
    <WixVariable Id="WixStdbaLicenseRtf" Value="License.rtf" />

      <Chain>
      <PackageGroupRef Id="NetFx45Redist"/>
      <MsiPackage Id="AwesomeExcelSetupMSI"
                  SourceFile="$(var.SolutionDir)\AwesomeExcelSetup\bin\release\AwesomeExcelSetup.msi"
                  Vital="yes"
                  Compressed="yes"/>
    </Chain>
    </Bundle>
</Wix>