Creating a WiX Based MSI Package Using Visual Studio 2005
To create an MSI package based on WiX using Visual Studio 2005, you can download Votive 2.0. You can use Votive to create WiX-based MSI packages through the Visual Studio 2005 Integrated Development Environment (IDE). For information about how to download and use Votive, see “Windows Installer XML (WiX) Toolset” on the SourceForge Web site. Download and install Version 2.0.
Step 1: Add a WiX project to the SDKSample Visual Studio 2005 solution
After you download and install Votive 2.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
With the SDKSample Visual Studio 2005 solution open, right-click Solution 'SDKSample' (1 project), point to Add, and then click New Project.
In Project types, click WiX Projects.
In Templates, click WiX Project.
Name your project InstallSDKSample, and then click OK.
Right-click InstallSDKSample, and then click Properties. Expand the Application node, and type InstallSDKSample for the Output Name.
Click OK to close the InstallSDKSample Property Pages dialog box.
Right-click Product.wxs, and then click Rename. Rename the file to SDKSample.wxs.
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/2003/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
Id="put-guid3-here"
Manufacturer="Your Company"
InstallerVersion="200"
Platforms="Intel"
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="WHSgrp" LongName="Windows Home Server">
<Component Id="HomeServerConsoleTab.SDKSample.dll" Guid="put-guid4-here">
<File Id="HomeServerConsoleTab.SDKSample.dll" Name="Sample.dll" LongName="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
On the main menu, click File, and then click Save All.
On the main menu, click Build, and then click Configuration Manager.
In the Configuration Manager dialog, in Configuration, click SDKSample, and then click Release. Do the same for InstallSDKSample.
Make sure the Build check boxes are checked for both projects.
Click Close to close the Configuration Manager dialog.
Right-click Solution 'SDKSample' (2 projects), and then click Build Solution. If any build errors occur, correct them before continuing.
When the build finishes successfully, navigate to YourVisualStudioProjects\SDKSample\InstallSDKSample\bin\Release (where YourVisualStudioProjects is the location of your Visual Studio 2005 projects).
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.