Sonhja
Sonhja

Reputation: 8458

Adding .Net Framework on Wix installer duplicates installer

I'm deploying a simple .MSI installer. But, as test, I wanted to put as a prerequisite Microsoft .Net Framework 4.0, so I wrote this on my .wixproj:

  <ItemGroup>
      <BootstrapperFile Include=".NETFramework,Version=v4.0">
         <ProductName>.NET Framework 4.0</ProductName>
      </BootstrapperFile>
      <Bootstra pperFile Include="Microsoft.Windows.Installer.4.5">
         <ProductName>Windows Installer 4.5</ProductName>
      </BootstrapperFile>
  </ItemGroup>

And:

<Target Name="AfterBuild">
    <GenerateBootstrapper ApplicationFile="InstallTest" ApplicationName="Face Phi Install Test" BootstrapperItems="@(BootstrapperFile)" ComponentsLocation="Relative" CopyComponents="True" OutputPath="$(OutputPath)" Path="C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bootstrapper\" />
</Target>

And on my .wxs project I wrote this:

<PropertyRef Id="NETFRAMEWORK40FULL"/>

This works fine, and I can put .Net Framework 4.0 as a prerequisite and doesn't allow the installation to proceed. But when I generate my SetupProject, I can see two installers:

enter image description here

  1. InstallTest.msi is the one I generate on my .wxs project. The second one, I don't know where it comes from. How can I have only one installer and connect it to my prerequisites?
  2. How can I auto-install .Net Framework, instead of cancelling the installation?

Upvotes: 0

Views: 405

Answers (1)

Tom Blodget
Tom Blodget

Reputation: 20812

The setup.exe is created by your GenerateBootstrapper build task and contains the logic to install the packages you have selected by BootstrapperFile elements. However, this doesn't include your InstallTest.msi.

To do that you need to create a bootstrapper package, which is a directory structure containing the msi file and a couple of xml files. Look at C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bootstrapper\Packages for examples. You can design one by hand and copy it into that Packages folder using build tasks. Microsoft's informal tool Bootstrapper Manifest Generator also helps when designing and copying packages and can be called from a build task.

Once you have a setup.exe that installs all of your packages, you might want to put all the files into a self-extracting archive such as WinRAR or WinZip. I use a very basic NSIS installer because it allows me to create a professional-looking, custom welcome screen.

Alternative

Instead of the Visual Studio bootstrapper, upgrade to WiX 3.7 and use a WiX Bootstrapper project (aka Burn project). The downside is that scripts to install dependencies under its system are not yet widely available, though a script for .NET is in the documentation. [See the topic "How To: Install the .NET Framework Using Burn".] One of the many advantages of Burn is that it is also a self-extracting archive.

Upvotes: 2

Related Questions