Create an installer for website with WIX, part 3

In part 1 we saw how we can use a MS Build script to harvest all the files that needs to be installed and to create our msi installer. In part 2 we saw how we can add our own custom UI.

With only the files installed you don’t have a website running. At least not an ASP.NET MVC website. You have to register the website in the Internet Information Services (IIS), create an app pool with the correct framework selected and activate (start) the website.

This post will handle that part of the creation of the installer where we extend the project we used in part 1 & part 2.

Add the IISConfiguration WiX file

We start by adding a new item in our setup project, choose for an installer file and name it IISConfiguration.wxs. The template will create an empty WiX page with just an empty “Fragment” element.

We’ll start with adding a component for the application pool.

We add a “DirectoryRef” element that we point to our installation folder so that this will be run when handling the installation directory in the installer.

In the “Component” element we add the “iis:WebAppPool” element. Give it an id and name, the name will be displayed in IIS. Choose the Identity that will start the application pool.

You can choose “networkService”, “localService”, “localSystem”,”applicationPoolIdentity” or “other”. With “other’” you’ll have to create a user with a username and password that you have to assign to the “iis:WebAppPool” element “users” parameter (not in this example).

NOTE: I had to install the 3.8 version of the WiX toolset to be able to assign the “applicationPoolIdentity”. In previous versions this was apparently not possible.

If you work in Visual Studio you’ll notice the editor adds an red line under the “iis:WebAppPool” element. We have to add the IISExtension namespace in the Wix declaration.

Add the install website component

Next we’ll add a second component to our file to create the website in IIS.

Here we’ll have to an unique id, a description of the website ‘(will be shown in IIS), the directory where the website is installed (our “INSTALLFOLDER”) and the auto start variables.

In the “iis:Website” element you can add one or more “iis:WebAddress” elements to assign DNS names and TCP ports to the website.

Last but not least, we’ll have to connect the correct application pool to the website by adding a “iis:WebApplication” with a unique id and name (I took the website id) and a reference to the “iis:WebAppPool” element we created before.

Create and reference component group

It’s best practice to group these two components in a component group so you only have to add one reference to iis configuration elements.

Add this “ComponentGroup” in the “Target” element.

In the product.wxs file we have to place a reference to this component group in the “Feature” tag.

Update the MS Build file

Because we created an extra file to include in the build process we must be sure that the file is added in the MS Build file.

We have to update the item groups that contain the list of files to include as shown above.

Now open up the Developer Command Prompt for Visual Studio 2012 again and change the prompt to the setup project folder and type the next statement:

msbuild /t: Build;PublishWebsite;Harvest;WIX;DeleteTmpFiles

and hit enter.

You’ll see the build process will return an error. We added a reference to the IISExtensions library in our IISConfiguration.wxs file but we didn’t told the candle.exe and light.exe tools to take that into account.

Add in both commands the –ext WixIISExtension flag and run the MS build script again. This time it shouldn’t be returning any errors.

Test the installer

Let’s run the installer and see if it really adds our website.

During the installation you’ll see a message passing by that it’s configuring IIS. Complete the installation and open up the IIS manager (run inetmgr).


We’ll see a new Demo Website website on the left hand side and a new application pool DemoWebsite on the right hand side running .NET 4.0 under the correct application pool identity.


If we open up the advanced settings of the website we’ll see the correct physical path is used and the binding is correct.

You may have noticed that our website isn’t started (the stop sign on the website icon). This isn’t a fault of the installer, it tried to start the website but because we choose port 80 in our installer IIS noticed there is another site running on that port (Default Web Site) and refuses to start our installed website.

If you change the port in the installer (or remove/stop the default webs site before installing) you’ll notice it starts upon install.

Next parts

This concludes the installation in IIS. Next part we’ll handle the creation of the database using the entered credentials and running SQL scripts from the installer.

  • Install the .NET 4.5 framework if that isn’t installed already
  • Install the MVC 4 framework if that isn’t installed already.
  • Create a folder and copy all needed files to run the application (done)
  • Create a new database on an existing SQL server and prefill the database with the correct tables and values. (the connection details and database name should be entered by the end user running the installer)
  • Create a new website in IIS 7.5 (create website and application pool running under .NET 4.5) (done)
  • Alter the config file so the correct connection settings are used (entered by the end user)

Complete source code

Can be found on Github.

Other posts in this series:

20 thoughts on “Create an installer for website with WIX, part 3

  1. Pingback: Create an installer for website with WIX, part 1 | Bart De Meyer - Blog

  2. Pingback: Create an installer for website with WIX, part 2 | Bart De Meyer - Blog

    1. Bart De Meyer Post author

      It’s been busy weeks at and after work. I hope to finish the series by the end of the month.



    1. Bart De Meyer Post author

      Part 4 is on the blog, I did found some time yesterday evening 😉



  3. Huw Bristow


    thanks for this article very useful, however I am stuck compiling the wix project. I am using wix 3.8 and am getting the error

    Error 1 Unresolved reference to symbol ‘WixComponentGroup:MyWebWebComponents’ in section ‘Product:{D16E42B5-3C6F-4EE5-B2F4-727BF8B74A92}’. C:\Users\h.bristow\Downloads\WIXInstallerDemo-master\WIXInstallerDemo-master\DemoWebsite.Setup\Product.wxs 15 1 DemoWebsite.Setup

    any ideas?

    here is the full build output

    —— Rebuild All started: Project: DemoWebsite, Configuration: Release Any CPU ——
    DemoWebsite -> C:\Users\h.bristow\Downloads\WIXInstallerDemo-master\WIXInstallerDemo-master\DemoWebsite\bin\DemoWebsite.dll
    —— Rebuild All started: Project: DemoWebsite.Setup, Configuration: Release x86 ——
    C:\Program Files (x86)\WiX Toolset v3.8\bin\Heat.exe project C:\Users\h.bristow\Downloads\WIXInstallerDemo-master\WIXInstallerDemo-master\DemoWebsite\DemoWebsite.csproj -configuration Release -directoryid INSTALLFOLDER -platform AnyCPU -pog Binaries -pog Symbols -pog Sources -pog Content -pog Satellites -pog Documents -projectname DemoWebsite -ag -sfrag -out obj\Release\_DemoWebsite.wxs
    C:\Program Files (x86)\WiX Toolset v3.8\bin\candle.exe -d”DevEnvDir=C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\\” -dSolutionDir=C:\Users\h.bristow\Downloads\WIXInstallerDemo-master\WIXInstallerDemo-master\ -dSolutionExt=.sln -dSolutionFileName=DemoWebsite.sln -dSolutionName=DemoWebsite -dSolutionPath=C:\Users\h.bristow\Downloads\WIXInstallerDemo-master\WIXInstallerDemo-master\DemoWebsite.sln -dConfiguration=Release -dOutDir=bin\Release\ -dPlatform=x86 -dProjectDir=C:\Users\h.bristow\Downloads\WIXInstallerDemo-master\WIXInstallerDemo-master\DemoWebsite.Setup\ -dProjectExt=.wixproj -dProjectFileName=DemoWebsite.Setup.wixproj -dProjectName=DemoWebsite.Setup -dProjectPath=C:\Users\h.bristow\Downloads\WIXInstallerDemo-master\WIXInstallerDemo-master\DemoWebsite.Setup\DemoWebsite.Setup.wixproj -dTargetDir=C:\Users\h.bristow\Downloads\WIXInstallerDemo-master\WIXInstallerDemo-master\DemoWebsite.Setup\bin\Release\ -dTargetExt=.msi -dTargetFileName=DemoWebsite.Setup.msi -dTargetName=DemoWebsite.Setup -dTargetPath=C:\Users\h.bristow\Downloads\WIXInstallerDemo-master\WIXInstallerDemo-master\DemoWebsite.Setup\bin\Release\DemoWebsite.Setup.msi -dDemoWebsite.Configuration=Release -d”DemoWebsite.FullConfiguration=Release|AnyCPU” -dDemoWebsite.Platform=AnyCPU -dDemoWebsite.ProjectDir=C:\Users\h.bristow\Downloads\WIXInstallerDemo-master\WIXInstallerDemo-master\DemoWebsite\ -dDemoWebsite.ProjectExt=.csproj -dDemoWebsite.ProjectFileName=DemoWebsite.csproj -dDemoWebsite.ProjectName=DemoWebsite -dDemoWebsite.ProjectPath=C:\Users\h.bristow\Downloads\WIXInstallerDemo-master\WIXInstallerDemo-master\DemoWebsite\DemoWebsite.csproj -dDemoWebsite.TargetDir=C:\Users\h.bristow\Downloads\WIXInstallerDemo-master\WIXInstallerDemo-master\DemoWebsite\bin\ -dDemoWebsite.TargetExt=.dll -dDemoWebsite.TargetFileName=DemoWebsite.dll -dDemoWebsite.TargetName=DemoWebsite -dDemoWebsite.TargetPath=C:\Users\h.bristow\Downloads\WIXInstallerDemo-master\WIXInstallerDemo-master\DemoWebsite\bin\DemoWebsite.dll -out obj\Release\ -arch x86 -ext “C:\Program Files (x86)\WiX Toolset v3.8\bin\\WixUIExtension.dll” -ext “C:\Program Files (x86)\WiX Toolset v3.8\bin\\WixIIsExtension.dll” -ext “C:\Program Files (x86)\WiX Toolset v3.8\bin\\WixUtilExtension.dll” -ext “C:\Program Files (x86)\WiX Toolset v3.8\bin\\WixSqlExtension.dll” Database.wxs DemoUI.wxs IISConfiguration.wxs Product.wxs UIDIalogs.wxs obj\Release\Product.Generated.wxs obj\Release\_DemoWebsite.wxs
    C:\Program Files (x86)\WiX Toolset v3.8\bin\Light.exe -out C:\Users\h.bristow\Downloads\WIXInstallerDemo-master\WIXInstallerDemo-master\DemoWebsite.Setup\bin\Release\DemoWebsite.Setup.msi -pdbout C:\Users\h.bristow\Downloads\WIXInstallerDemo-master\WIXInstallerDemo-master\DemoWebsite.Setup\bin\Release\DemoWebsite.Setup.wixpdb -cultures:null -ext “C:\Program Files (x86)\WiX Toolset v3.8\bin\\WixUIExtension.dll” -ext “C:\Program Files (x86)\WiX Toolset v3.8\bin\\WixIIsExtension.dll” -ext “C:\Program Files (x86)\WiX Toolset v3.8\bin\\WixUtilExtension.dll” -ext “C:\Program Files (x86)\WiX Toolset v3.8\bin\\WixSqlExtension.dll” -contentsfile obj\Release\DemoWebsite.Setup.wixproj.BindContentsFileListnull.txt -outputsfile obj\Release\DemoWebsite.Setup.wixproj.BindOutputsFileListnull.txt -builtoutputsfile obj\Release\DemoWebsite.Setup.wixproj.BindBuiltOutputsFileListnull.txt -wixprojectfile C:\Users\h.bristow\Downloads\WIXInstallerDemo-master\WIXInstallerDemo-master\DemoWebsite.Setup\DemoWebsite.Setup.wixproj obj\Release\Database.wixobj obj\Release\DemoUI.wixobj obj\Release\IISConfiguration.wixobj obj\Release\Product.wixobj obj\Release\UIDIalogs.wixobj obj\Release\Product.Generated.wixobj obj\Release\_DemoWebsite.wixobj
    C:\Users\h.bristow\Downloads\WIXInstallerDemo-master\WIXInstallerDemo-master\DemoWebsite.Setup\Product.wxs(15,0): error LGHT0094: Unresolved reference to symbol ‘WixComponentGroup:MyWebWebComponents’ in section ‘Product:{D16E42B5-3C6F-4EE5-B2F4-727BF8B74A92}’.
    Done building project “DemoWebsite.Setup.wixproj” — FAILED.


    1. kombain

      This error occurs because in in Build action msbuild compiles whole solution including wix project, which cannot be compiled before creating WebSiteContent.wxs by heat.exe (which is done in ‘Harvest’ step)
      You should disable building wixproj in solution. Just right click on Solution, click Configuration Manager and uncheck your wix project in every configuration and platform (change it by choosing from two dropdown lists at the top of the window)..

  4. Troels


    I noticed that the website and app pool are still present in IIS after uninstalling the package. This can be fixed by generating and adding guids to the Guid attributes in the IISConfiguration.wxs file. I don’t know whether the attributes were left blank intentionally, but I assume that it is ok to assign guids.

    – Troels

  5. Sofya Amato

    Hi Bart,

    I really appreciate the comprehensive and detailed articles. However, I have encountered an issue with WIX duplicating port 80 binding in IIS8. Would you have any idea how to solve this?

    Thank you again for your time and effort!


  6. Sofya Amato

    Hi again,

    I figured it out based on I had to move the iis:Website out of Component tag and move it under Product

    Nesting WebSite under a Component element will result in a WebSite being installed to the machine as the package is installed.
    Nesting WebSite under Product, Fragment, or Module results in a web site “locator” record being created in the IIsWebSite table. This means that the web site itself is neither installed nor uninstalled by the MSI package. It does make the database available for referencing from a WebApplication, WebVirtualDir or WebDir record. This allows an MSI to install WebApplications, WebVirtualDirs or WebDirs to already existing web sites on the machine. The install will fail if the web site does not exist in these cases.

  7. Jed Cayetano

    Hi Bart,

    I’m getting this error during candle in developer command prompt: error CNDL0200: The component element contains an unhandled extension element ‘iis:WebAppPool’. Please ensure that the extension for elements in the ‘’ namespace has been provided.

    I have already added the ‘xmlns:iis=”” ‘ in the wix declaration and also added the ‘-ext WixIISExtension’ in both candle and light commands in

    Anything else I’m missing?


  8. Meerraj

    Article is really a great help. Thanks for it.

    I have one question … for last couple of days I am looking out how to display all the app pools available on server on wix UI so that the user can select one which is suitable. I found some site which suggest to use custom action for the same. Is there any way or setting which can be used to achieve this .

    Thanks in advance !!!!

  9. Pingback: Create an installer for website with WIX, part 4 | Bart De Meyer – Blog

  10. Patrick

    Heya, just want to give a shout out to this how-to. Still using it in 2020! Not everything lives in de cloud or can be accessed via the publish website method and this still works!


Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.