Creating a WiX installer for ASP.NET Web Applications

Manually maintaining a Windows Installer for a large ASP.NET web application using Wix Toolset can be a very time consuming and error prone task.

In this tutorial I’m going to show you how to use WiX Toolset and Web Deploy (msdeploy) to create a Windows Installer for ASP.NET web applications.

Source Code:



The installer is created during the build process on the developer’s workstation or a build server. During the build process, Visual Studio compiles the web application and all of its dependencies and creates a Web Deploy package of all necessary files and folders.

Compile ➜ Package ➜ Harvest ➜ Create MSI


Install ➜ Create Application Pool ➜ Create Website ➜ Start

Step 1: Add a WiX setup project

Before adding a new setup project, Make sure you installed the latest version of WiX Toolset.

This tutorial is based on WiX Toolset version 3.10.3

To add a new setup project in Visual Studio go to File ➜ New ➜ Project…

Add WiX Setup Project

Add a new Installer (.wxs) file. The file name should be the same as the web application name.

Add Installer File

Step 2: Add project reference

Add project reference from the WiX setup project to the web application project.

Add Reference

Add Project Reference

Step 4: Pack and harvest web application

To automatically update the installer every time the setup project builds, Open WiX setup project file (.wixproj) using any text editor (To edit the file using Visual Studio, Unload the WiX setup project, right-click the project name and select Edit WebApp.wxs).

Add <WebProject>True</WebProject> to the web application project reference.

<ProjectReference Include="..\WebApp\WebApp.csproj">

Paste the following XML snippet inside <Project></Project> tag.

<Target Name="BeforeBuild">
  <!-- Remove read-only attribute -->
  <Exec Command="attrib -R %(ProjectReference.Filename).wxs" Condition="'%(ProjectReference.WebProject)'=='True'" />
  <!-- Package web application using Web Deploy (msdeploy) -->
  <MSBuild Projects="%(ProjectReference.FullPath)" Targets="Package" Properties="Configuration=$(Configuration);Platform=Any CPU" Condition="'%(ProjectReference.WebProject)'=='True'" />
    <LinkerBindInputPaths Include="%(ProjectReference.RootDir)%(ProjectReference.Directory)obj\$(Configuration)\Package\PackageTmp\" />
  <!-- Generate a WiX installer file using Heat Tool -->
  <HeatDirectory OutputFile="%(ProjectReference.Filename).wxs" Directory="%(ProjectReference.RootDir)%(ProjectReference.Directory)obj\$(Configuration)\Package\PackageTmp\" DirectoryRefId="INSTALLFOLDER" ComponentGroupName="%(ProjectReference.Filename)" AutogenerateGuids="True" SuppressCom="True" SuppressFragments="True" SuppressRegistry="True" ToolPath="$(WixToolPath)"  Condition="'%(ProjectReference.WebProject)'=='True'" />

To disable Web.Config automatic connection string parameterization set MSBuild property AutoParameterizationWebConfigConnectionStrings to False.

Here’s a .wixproj file for example WebAppInstaller.wixproj

NuGet Packages Statistics Update

The Nuget team informed me that they will be increasing the download counts of my NuGet packages this week.

Their old statistics warehouse contained download facts for non-normalized versions, whereas all of their services only take normalized versions into account. The normalized version standardizes the version formats in use and makes querying and comparing packages easier. Say a package has version, they normalize that version into 2.0.0 and work with that version number instead. The same goes for 2.0 which becomes 2.0.0, essentially considering and 2.0 as the same version. Another example would be version, which is normalized as

Unfortunately, the old statistics warehouse was never updated when they started normalizing version numbers. The result of this change a few years ago was that the NuGet gallery no longer listed the correct number of package downloads, which they are now fixing.

Over the next few days, they will be making the following changes:

  • NLoad 0.1.0 - increase with 18 downloads
  • NLoad 0.2.1 - increase with 19 downloads
  • NLoad 0.2.2 - increase with 16 downloads
  • NLoad 0.2.5 - increase with 17 downloads
  • NLoad 0.2.6 - increase with 14 downloads
  • NLoad 0.2.7 - increase with 17 downloads
  • NLoad 0.3.12 - increase with 11 downloads
  • NLoad 0.3.14 - increase with 10 downloads
  • NLoad 0.3.17 - increase with 10 downloads
  • NLoad 0.3.19 - increase with 16 downloads
  • NLoad 0.3.1 - increase with 10 downloads
  • NLoad 0.3.3 - increase with 11 downloads
  • NLoad 0.3.7 - increase with 17 downloads
  • NAnt.Core 0.92.0 - increase with 53 downloads

NLoad - A simple performance and load testing framework for .NET

Over the last few months I’ve been working on a new open-source project called NLoad.

NLoad is a simple performance and load testing framework for .NET used for testing Websites, WCF Services and small bits of code to identify and eliminate bottlenecks at an early stage of development.

The main goal of NLoad is to provide a quick way to generate load using multiple threads on a single machine.

For further information and instructions on using NLoad in your projects please visit NLoad Website.

Welcome to my new website

Over the last week I’ve been working on a new website based on GitHub Pages.

Learning GitHub Pages was easy and I found the whole concept very useful for creating static websites and I took the opportunity to build a new personal website.

The new website features a blog section where I will be able to write articles about Software Development and Architecture and keep friends and clients up to date with any news in my little dev empire.

The site is powered by Jekyll and I’ve developed a custom theme to suit my needs.

Please let me know what you think.

Your comments, suggestions and complaints will help me shape the further evolution and improvement of the website.