开发者

WiX: .Net 3.5 prerequisite

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>
<Bootstr开发者_开发百科apperFile 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?


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.


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


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


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜