Prerequisites

by Markus 29. October 2009 23:08

 

How to tell WiX to install Prerequisites

 

Prerequisites like the DotNet Framework or SQL Server Express Edition and so on can not be defined in the wxs files. They have to be defined in the project File itself.

Step 1

  • Right click the Project in the Solution Explorer and click on Unload Project
  • Right click the Project in the Solution Explorer again and click on Edit <ProjectName>

Step 2

In the Project File right below the <Project …> Start Tag insert the Tags to define the Prerequisites you want enclosed in an Itemgroup Tag. E.g.:

 

<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <!--Add Bootstrapper Files here-->
  <ItemGroup>
    <BootstrapperFile Include="Microsoft.Net.Framework.3.5">
      <ProductName>.NET Framework 3.5</ProductName>
    </BootstrapperFile>
    <BootstrapperFile Include="Microsoft.Windows.Installer.3.1">
      <ProductName>Windows Installer 3.1</ProductName>
    </BootstrapperFile>
    <BootstrapperFile Include="Microsoft.SQL.Server.Compact.3.5">
      <ProductName>Microsoft SQL Server Compact 3.5</ProductName>
    </BootstrapperFile>
    <BootstrapperFile Include="Microsoft.SQL.Server.Compact.3.5 x64">
      <ProductName>Microsoft SQL Server Compact 3.5 x64</ProductName>
    </BootstrapperFile>
  </ItemGroup>

   ………

Notes:

  • For a normal Visual Studio 2008 installation some predefined Bootstrapper Packages are located under C:\Program Files\Microsoft SDKs\Windows\v6.0A\Bootstrapper\Packages
  • The String for the Include Attribute above can be found in the Product.xml file of the Package in the ProductCode Attribute of the Package Tag.
  • The Content of ProductName Tag above is, as far as I know, not important and you can just set a good name.

 

Step 3

At the End of the Project File place the following tag:

<Target Name="AfterBuild">
  <GenerateBootstrapper
    ApplicationFile="$(TargetFileName)"
    ApplicationName="My Application Name"
    BootstrapperItems="@(BootstrapperFile)"
    ComponentsLocation="Relative"
    CopyComponents="True"
    OutputPath="$(OutputPath)"
    Path="C:\Program Files\Microsoft SDKs\Windows\v6.0A\Bootstrapper\" />
</Target>

This tells the WiX Compiler to create a Setup.exe Bootstrapper aside your .msi file.

 

Step 4

Save and close the Project File and right Click the Project in the Solution Explorer and Click on Reload Project

 

 

<= Back to Content

Tags: ,

About MaHop.Net

Just look on our Webpage http://www.mahop.net

Tag cloud