In this blog, I will be explaining the creation of the installation package to Deploy Website, Create AppPool, Create Database with Script and Install Windows Service. To create installation package I have used WiX toolset.
Why choose WiX to create Installer?
It is an XML based open source toolset to build Windows Installation packages. WiX is easy to understand and has lots of inbuilt libraries for UI, command line utilities, that help to create a quality package installer.
Download latest WiX release from: http://wixtoolset.org/releases/
Keep a machine ready with following pre-requisites software:
- Windows 7/Windows Server 2008 R2
- Wix 3.9 or greater version
- Visual Studio 2010 or greater version
Create Project in Visual Studio
Create new Windows Installer XML->Setup Project from Visual Studio IDE. Add following files in the project:
Add assemblies and references
You will need to add references of following dlls into the project:
Change content of Product.wxs file
Product.wxs contains Installation/Upgrade Version details, App Pool, Virtual Directory and UI references. Below mentioned code snippet is for Installation version and up gradation key:
Before deploying website, check whether IIS is installed or not:
Add following lines to create app pool and virtual directory for website.
Add custom and inbuilt dialogs to installer
Define features list and dialog boxes in UI.wxs file. Publish dialog(s) as per your requirement, like “WelcomeDlg”, “LicenseAgreementDlg”, “CustomizeDlg” etc.:
Add custom dialog box to take user credentials, follow below mentioned lines:
Harvest files and folders for installer
Go to WiX install location\bin folder and from command prompt run the following to harvest files/folders of your applications:
heat dir c:\yourbinariesfolders -gg -g1 -sfrag -cg WhatThe -out Files.wxs
Above command will generate Files.wxs Add this file to Installer project.
Change component to enable Windows service installation feature
In Files.wxs, you need to do the following changes to enable installer for windows service installation:
Execute sql script
In Files.wxs, add a component as below mentioned:
Add Sql file as binary.
Change product name and package description.
Compile the project to produce .msi file and this can be used to install software package.
This is a complete, all-in-one installer that installs Website, creates AppPool, sets user Identity, Installs windows service and runs the database script.
To get more details visit: