WIX- Windows Installer & XML- to Publish an Automated Website

There are situation when, you have to publish the link in certain intervals. So rather than doing it manually, we can develop a wix file, which can be scheduled in TFS & which can take the setup files from TFS & publish automatically.Please follow these points:
  1. Install Wix to get wix project templates in VS.
  2. New solution, create new web application & publish it.
  3. Add new project to solution, project type Wix-Setup Project.
  4. Product.wxs is the default file, where you have the product information, name,GUID & what all files to be included as part of the product.
  5. You have to setup the Dialogs via UI's and IIS ROOT configuration to publish the web site, which is going to be defined in Fragment sections individually.
  6. Before that you have to include, IIsExtension, UtilExtension, NetFxExtension to Product.wxs.
  7. Setup the fragments carefully & Dialogues.
  8. Create a new file called wix include file (.wxi), which contains the default settings for the app.
  9. Create a new file called "DemoUI.wxs", which holds the actions for the buttons exists in UI Fragment.
  10. Create a new file called "Setup.build", which holds PropertyGroup, ItemGroup, Targets saying Build, PublishWebsite, Harvest, WIX (these are all names of Targets) with in the Project Tag.
  11. In PropertyGroup, Check <Publish> to add the code published folder & <MsiOut> tag is the name&path of the folder where the output is going to be stored.
  12. After successful complition of adding the items to the wix project. Do a recheck of things in files.
  13. Go to Start-VS-Developer Command Prompt.
  14. Move to the location of Setup.build file on the wix project.
  15. Try executing the following command:

    msbuild.exe /t:harvest;wix setup.build

  16. It will complete the execution if it dont have any setup errors, else check the error info to fix it.
  17. Next, go the output directory you 've specified in <MsiOut> in PropertyGroup tag of Setup.build file, and you can find a .msi file.
  18. Try executing the .msi file by providing the valid inputs.
  19. Go to inetpub & check your website with the given alias & app pool exists or not.
  20. If exists, try executing the website to see all the files are working or not.
By writing some powershell script on postbuild events,
  1. Open the website- Properties, Build Events- On postbuild script, Before that try to create a batch file which contains the info like following CD %1msbuild /t:Harvest;WIX %2here%1 is source file location, %2 is file name.
  2. Try to execute this batch file from Postbuild script.
So, when ever you build the website, it will automatically generate the .msi file in perticular folder. so you can share that .msi file to the testing team, they can directly double hit and install the binaries which automatically creates a website in the IIS server with new app pool.