views:

459

answers:

4

I have a WiX installer that I would like to check for .Net 3.5, and install it if it does not exist. I have the following lines in my wixproj file:

<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>

When I create the installer, a DotNetFX35 folder is created, and in it are 4 different versions of .Net (including 3.5), and an installer file.

I have two questions:

  1. How do I have it only bring in version 3.5 (so that the user doesn't have to install 100+ MB of files)?

  2. How do I tell WiX to package these files up into the MSI file, so that the user only has to download 1 file?

+1  A: 

To answer part 2 of your question:

The idea of a bootstrapper is to provide a .exe that doesn't have much (if any) dependencies. This makes sure you can also bootstrap stuff like Windows Installer. Because of this, the bootstrapper is the .exe that either contains or downloads the required files.

This also makes sure that when you already have some component installed, it doesn't get downloaded again. You can't package everything in one msi for this reason, and also because that would mean that when there's a security fix to .NET, you have to patch it. When .NET is installed using its own installer, Microsoft can release patches to it

Sander Rijken
+1  A: 
  1. I think you are better of creating a separate project for the bootstrapper. If a web-install is sufficient, the following project template should work:

    <Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5">
    <ItemGroup>
        <BootstrapperFile Include="Microsoft.Windows.Installer.3.1">
            <ProductName>Windows Installer 3.1</ProductName>
        </BootstrapperFile>
        <BootstrapperFile Include="Microsoft.Net.Framework.3.5.SP1">
            <ProductName>.NET Framework 3.5 SP1</ProductName>
        </BootstrapperFile>
    </ItemGroup>
    <Target Name="Bootstrapper">
        <GenerateBootstrapper
            ApplicationFile="MyProject.msi"
            ApplicationName="MyProject"
            BootstrapperItems="@(BootstrapperFile)"
            OutputPath="$(OutputPath)"
            Culture="en-US"
            CopyComponents="true"
            ComponentsLocation="HomeSite"
            Path="$(BootstrapperPath)" />
    </Target></Project>
    
  2. The WiX team is working on Burn, a new bootstrapper, but until it is ready for production use, you may use one of the (commercial) solutions to build a self extracting single executable that automatically runs "setup.exe".

Armin
A web install is fine. I amended my project file with the above, but it doesn't prompt me to install either the windows installer, .Net 3.5. I'm positive .Net is not already on the machine, as I just did a fresh install (Windows 7 Ultimate). I also don't see .Net in the Uninstall Programs list (though there's only 1 item there, so maybe Windows is protecting me from myself, there). All I copied over to the test machine was the msi file. Did I need something else for a web install?
Mike Pateras
I should note taht I only changed the ApplicationFile and the ApplicationName properties. Everything else I left the same. I set the ApplicationFile to the name of my msi file (I didn't add a path), and I set the Application Name to the name of my application, but I don't know if that's supposed to correspond with anything else. I just wrote what looked right.
Mike Pateras
You need the bootstrapper (setup.exe) that should have been created by the above project, the prerequisites (.NET) are then loaded before the MSI is run.
Armin
When I run setup.exe, it just launches my installer. It doesn't do anything with .Net. I'm not sure where to go from here.
Mike Pateras
I think I know what's wrong, here. I'm running my installer on a Windows 7 box, which will apparently come with .Net 3.5 installed, which is why I'm not seeing anything when my installer starts. I'll post back if I test on an older OS and it doesn't work.
Mike Pateras
+3  A: 

How do I have it only bring in version 3.5 (so that the user doesn't have to install 100+ MB of files)?

You mentioned that there are "4 different versions" of .NET in there. There are actually only 3: DotNetFX20, DotNetFX30, and DotNetFX35 and some windows updates. The reason is that .NET 3.5 and .NET 3.0 are actually mostly additive releases on top of the .NET 2.0 framework libraries and runtime.

In other words, .NET 3.0 and .NET 2.0 are both prerequisites of .NET 3.5. You need all of these files if your application targets .NET 3.5.

However, some applications only need the subset of .NET 3.5 called the .NET 3.5 client profile. You can try this by checking the "client only framework" checkbox in the build options of your visual studio projects.

If your application still builds and works OK with the client profile, then you can change "Microsoft.Net.Framework.3.5" into "Microsoft.Net.Client.3.5". This is only 28MB.

How do I tell WiX to package these files up into the MSI file, so that the user only has to download 1 file?

The prerequisites need to be installed before the MSI is launched, so they cannot be part of the MSI. However, you can do the opposite: package both the prerequisites and the MSI in a self-extracting archive, e.g. with WinZip Self-Extractor. The self-extracting archive can invoke the extracted setup.exe.

Wim Coenen
+1  A: 

Check out dotNetInstaller http://dotnetinstaller.codeplex.com. It's an install bootstrapper so you can use it to check for and install dependencies for your application. You can also embed the installers to produce a single setup.exe. Here's an excerpt from their help file "Distribute a single, compressed, executable packaged setup with all pre-requisites."

mcdon