Creating a WiX Based MSI Package Using Visual Studio 2008

To create an MSI package based on WiX using Visual Studio 2008, you can download Votive 3.0. You can use Votive to create WiX-based MSI packages through the Visual Studio 2008 Integrated Development Environment (IDE). For information about how to download and use Votive, see “Windows Installer XML (WiX) Toolset” on the SourceForge website. Click on Weekly Releases. In Index of /releases, select the most recent version of WiX 3.0. Download and install Wix3.msi.

Important

Votive 3.0 is still in beta. Future versions of Votive 3.0 may affect the following steps.

Step 1: Add a WiX project to the SDKSample Visual Studio 2008 solution

After you download and install Votive 3.0, add a WiX project to the SDKSample solution that you created in the topic Setting Up an Add-In Solution.

To create a WiX project

  1. With the SDKSample Visual Studio 2008 solution open, right-click Solution 'SDKSample' (1 project), point to Add, and then click New Project.

  2. In Project types, click WiX.

  3. In Templates, click WiX Project.

  4. Name your project InstallSDKSample, and then click OK.

  5. Right-click InstallSDKSample, and then click Properties. Select the Installer tab, and type InstallSDKSample for the Output Name.

  6. Close the InstallSDKSample properties page.

  7. Right-click Product.wxs, and then click Rename. Rename the file to SDKSample.wxs.

  8. Double-click the SDKSample.wxs file in Solution Explorer. You are now ready to modify the file for your add-in.

Step 2: Add the code to create the MSI package

To add the code to create the WiX-based MSI package, replace the code in SDKSample.wxs with the following code, and modify the names and paths for the files in your project as well as any globally unique identifiers (GUIDs):

Wxs Sample File

<?xml version="1.0" encoding="utf-8"?>
<Wix xmlns="https://schemas.microsoft.com/wix/2006/wi">
  <Product
    Name="My Windows Home Server SDK Sample"
    Id="put-guid1-here"
    UpgradeCode="put-guid2-here"
    Manufacturer="Your Company"
    Version="1.0.0"
    Language="1033"
    Codepage="1252">
    <Package
      Manufacturer="Your Company"
      InstallerVersion="200"
      Languages="1033"
      Compressed="yes"
      SummaryCodepage="1252" />
    <Media Id="1" EmbedCab="yes" Cabinet="SDKSample_cab" />

    <Property Id="WHSLogo">1</Property>

    <Condition Message="[ProductName] requires Windows Home Server. For more information, please refer to the User Guide.">VersionNT = 502</Condition>

    <Directory Id="TARGETDIR" Name="SourceDir">
      <Directory Id="ProgramFilesFolder" Name="PFiles">
        <Directory Id="WHS" Name="Windows Home Server">
          <Component Id="HomeServerConsoleTab.SDKSample.dll" Guid="put-guid3-here">
            <File Id="HomeServerConsoleTab.SDKSample.dll" Source="..\SDKSample\bin\release\HomeServerConsoleTab.SDKSample.dll" Vital="yes" KeyPath="yes" DiskId="1"/>
          </Component>
        </Directory>
      </Directory>
    </Directory>

    <Feature Id="DefaultFeature" Level="1">
      <ComponentRef Id="HomeServerConsoleTab.SDKSample.dll" />
    </Feature>
  </Product>
</Wix>

The following points are important to note:

  • The element <Property Id="WHSLogo">1</Property> specifies that this is a Windows Home Server add-in. Adding this property and setting it to a value of 1 enables Windows Home Server to recognize the MSI package as a Windows Home Server add-in.

  • The element <Condition Message="[ProductName] requires Windows Home Server. For more information, please refer to the User Guide.">VersionNT = 502</Condition> is important because it prevents installing the MSI package on an operating system other than Windows Home Server or Windows Server 2003.

  • You should replace all of the GUIDs in the sample .wxs file. You can use the Visual Studio GUID generator to create new GUIDs.

Step 3: Build the SDKSample solution

With the code for the WiX project entered and the code for the SDKSample class library project entered, you are now ready to build your entire add-in solution.

To build the SDKSample solution

  1. On the main menu, click File, and then click Save All.

  2. On the main menu, click Build, and then click Configuration Manager.

  3. In the Configuration Manager dialog, in Configuration, click SDKSample, and then click Release. Do the same for InstallSDKSample.

  4. Make sure the Build check boxes are checked for both projects.

  5. Click Close to close the Configuration Manager dialog.

  6. Right-click Solution 'SDKSample' (2 projects), and then click Build Solution. If any build errors occur, correct them before continuing.

  7. When the build finishes successfully, navigate to YourVisualStudioProjects\SDKSample\InstallSDKSample\bin\Release (where YourVisualStudioProjects is the location of your Visual Studio 2008 projects).

  8. Verify that the InstallSDKSample.msi file is created. You will copy this file to the server in the Deploying the Add-In MSI section of this tutorial.

Step 4: (Optional) Create an End User License Agreement

You can include an End User License Agreement (EULA) with your MSI package. To include a EULA with your MSI package, the EULA text must be saved in a file of Rich Text Format (.rtf), and it must have the same name as the MSI file. For example, to create a EULA for the InstallSDKSample.msi, you create an InstallSDKSample.rtf file.

You will deploy the EULA file when you deploy the MSI file.

Your MSI package is now complete. Continue to the Deploying the Add-In MSI section of this tutorial.