Amin Merati
Amin Merati

Reputation: 2291

Wix Installation package could not be opened

I am using Wix bundling to install .net framework version 4.6.1 before a main .msi installer. I am using wix tool set 3.11 which is the latest weekly release http://wixtoolset.org/downloads/v3.11.0.1307/wix311.exe

Here is the file Bundle.wxs

<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"
     xmlns:netfx="http://schemas.microsoft.com/wix/NetFxExtension"
     xmlns:bal="http://schemas.microsoft.com/wix/BalExtension">
    <Bundle Name="RevieweBootstrapper" Version="1.0.0.0" Manufacturer="Microsoft" UpgradeCode="37650dfa-8f11-4934-82fd-f720d95c86d7">
        <BootstrapperApplicationRef Id="WixStandardBootstrapperApplication.RtfLicense">
          <bal:WixStandardBootstrapperApplication
            LicenseFile="License.rtf"
            ShowVersion="yes"
            />
        </BootstrapperApplicationRef>
    <Chain>
            <PackageGroupRef Id="NetFx461Web"/>
            <MsiPackage Id = "Reviewer.Setup" SourceFile="..\ReviewerInstaller\bin\Release\ReviewerInstaller.msi" />
        </Chain>
    </Bundle>
</Wix>

The file ReviewerInstaller.msi is the main installer. I am using light and candle to build the installer.

"C:\Program Files (x86)\WiX Toolset v3.11\bin\candle" -ext WixBalExtension -ext WixIISExtension -ext WixUtilExtension -ext WixSqlExtension -ext WixNetFxExtension -dpublishDir=..\Reviewer.Web\bin\PackageTmp -dMyWebResourceDir=. Bundle.wxs Windows Installer XML Toolset Compiler version 3.11.0.1307 Copyright (c) .NET Foundation and contributors. All rights reserved.

Bundle.wxs "C:\Program Files (x86)\WiX Toolset v3.11\bin\light" -ext WixBalExtension -ext WixIISExtension -ext WixUIExtension -ext WixUtilExtension -ext WixNetFxExtension -ext WixSqlExtension -out bin\Release\ReviewerInstallerPrerequisite.msi Bundle.wixobj Windows Installer XML Toolset Linker version 3.11.0.1307 Copyright (c) .NET Foundation and contributors. All rights reserved.

c:\Projects\NewCheckout\reviewer\RevieweBootstrapper\Bundle.wixobj : warning LGHT1109: Found mismatched entry point . Expected for specified output package type .msi. [c:\Projects\reviewer\RevieweBootstrapper\setup.build] Install package has been created. Done Building Project "c:\Projects\reviewer\RevieweBootstrapper\setup.build" (WIX target(s)).

Build succeeded.

"c:\Projects\reviewer\RevieweBootstrapper\setup.build" (WIX target) (1) -> (WIX target) -> c:\Projects\reviewer\RevieweBootstrapper\Bundle.wixobj : warning LGHT1109: Found mismatched entry point . Expected for specified output package type .msi. [c:\Projects\reviewer\RevieweBootstrapper\setup.build]

The build succeeds with the mentioned warning, however, when I am trying the built installer, I am getting the following error

"This installation package could not be opened. Contact the application vendor to verify that this is a valid Windows installer package"

could you help me how to resolve this?

Just for your reference the main installer works fine when I test it.

Here is wxs file for main installer:

<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
    <Product Id="*" Name="Reviewer" Language="1033" Version="1.0.0.0" Manufacturer="Eurotherm By Schneider-Electric" UpgradeCode="a3f989dc-6e50-4513-a692-09cd080673bc">
        <Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" />

        <MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
    <Media Id="1" Cabinet="cab1.cab" EmbedCab="yes" />

        <Feature Id="ProductFeature" Title="ReviewerInstaller" Level="1">
            <ComponentGroupRef Id="ProductComponents" />
      <ComponentGroupRef Id="WebComponents"/>
      <ComponentGroupRef Id="ReviewerIssConfiguration"/>
    </Feature>
    </Product>

    <Fragment>
        <Directory Id="TARGETDIR" Name="SourceDir">
            <Directory Id="CommonAppDataFolder">
                <Directory Id="Company" Name="Eurotherm">
                    <Directory Id="INSTALLFOLDER" Name="Reviewer" />
                </Directory>
            </Directory>
        </Directory>
    </Fragment>

    <Fragment>
        <ComponentGroup Id="ProductComponents" Directory="INSTALLFOLDER">
            <!-- TODO: Remove the comments around this Component element and the ComponentRef below in order to add resources to this installer. -->
            <!-- <Component Id="ProductComponent"> -->
                <!-- TODO: Insert files, registry keys, and other resources here. -->
            <!-- </Component> -->
        </ComponentGroup>
    </Fragment>
</Wix>

There is two more wxs files referenced in main installer

<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"
     xmlns:iis="http://schemas.microsoft.com/wix/IIsExtension">
    <Fragment>
    <DirectoryRef Id="INSTALLFOLDER">
      <Component Id="ReviewerAppPool" Guid="" KeyPath="yes">
        <iis:WebAppPool Id="ReviewerAppPool"
                        Name="Reviewer"
                        Identity="applicationPoolIdentity"
                         ManagedPipelineMode="Integrated" 
                        ManagedRuntimeVersion="v4.0" />
      </Component>

      <Component Id="InstallWebsite" Guid="" KeyPath="yes">
        <!-- Install to default web site -->
        <iis:WebSite Id="ReviewerWebsite" Description='Reviewer' Directory='INSTALLFOLDER' AutoStart='yes' StartOnInstall='yes'>
          <iis:WebAddress Id="AllUnassigned" Port="80" />
          <iis:WebApplication Id="ReviewerApplication" Name="[ReviewerWebsite][WEBSITE_ID]" WebAppPool="ReviewerAppPool"></iis:WebApplication>
        </iis:WebSite>
      </Component>
    </DirectoryRef>

    <ComponentGroup Id="ReviewerIssConfiguration">
      <ComponentRef Id="InstallWebsite" />
      <ComponentRef Id="ReviewerAppPool" />
    </ComponentGroup>
  </Fragment>
</Wix>

The other wxs file (Id="WebComponents") is populated using the heat command

Upvotes: 4

Views: 2445

Answers (1)

Amin Merati
Amin Merati

Reputation: 2291

I had to specify the target as ".exe" extension and not .msi when building the installer using candle and light

This is candle command which I had in my setup.build file "$(WixPath)bin\candle" -ext WixBalExtension -ext WixIISExtension -ext WixUtilExtension -ext WixSqlExtension -ext WixNetFxExtension -dpublishDir=$(Publish) -dMyWebResourceDir=. -dTargetExt=.exe -dTargetFileName=ReviewerInstaller.exe @(WixCode, ' ')

This is the light command "$(WixPath)bin\light" -ext WixBalExtension -ext WixIISExtension -ext WixUIExtension -ext WixUtilExtension -ext WixNetFxExtension -ext WixSqlExtension -out $(ExeOut) @(WixObject, ' ')

The variable $(WixPath) is defined in setup.build

I build the project using the following command in Visual Studio Developer Command Prompt

msbuild /target:WIX setup.build

Here is also content of my setup.build

<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="3.5" DefaultTargets="Build"
       xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <PropertyGroup>
    <WebSiteSource>..\DemoWebsite\</WebSiteSource>
    <Publish>..\Reviewer.Web\bin\PackageTmp</Publish>
    <ExeOut>bin\Release\ReviewerInstaller.exe</ExeOut>
    <WixPath>C:\Program Files (x86)\WiX Toolset v3.11\</WixPath>
  </PropertyGroup>

  <!-- The list of WIX input files -->
  <ItemGroup>
    <WixCode Include="Bundle.wxs" />
  </ItemGroup>

  <!-- The list of WIX after candle files -->
  <ItemGroup>
    <WixObject Include="Bundle.wixobj" />
  </ItemGroup>

  <!-- Define creating installer in another target -->
  <Target Name="Harvest">
    <!-- Harvest all content of published result -->
    <Exec
        Command='"$(WixPath)bin\heat" dir $(Publish) -dr INSTALLFOLDER -ke -srd -cg WebComponents -var var.publishDir -gg -out $(WebSiteContentCode)'
        ContinueOnError="false"
        WorkingDirectory="." />
  </Target>
  <Target Name="WIX">
    <!--     At last create an installer -->
    <Exec
        Command='"$(WixPath)bin\candle" -ext WixBalExtension -ext WixIISExtension -ext WixUtilExtension -ext WixSqlExtension -ext WixNetFxExtension -dpublishDir=$(Publish) -dMyWebResourceDir=. -dTargetExt=.exe -dTargetFileName=ReviewerInstaller.exe @(WixCode, &apos; &apos;)'
        ContinueOnError="false"
        WorkingDirectory="." />
    <Exec
        Command='"$(WixPath)bin\light" -ext WixBalExtension -ext WixIISExtension -ext WixUIExtension -ext WixUtilExtension -ext WixNetFxExtension -ext WixSqlExtension -out $(ExeOut) @(WixObject, &apos; &apos;)'
        ContinueOnError="false"
        WorkingDirectory="." />

    <!-- A message at the end -->
    <Message Text="Install package has been created." />
  </Target>
</Project>

Upvotes: 3

Related Questions