Updating a website

May 20, 2015 at 1:46 PM

I'am in the process to write installers for our websites. A basic wish is that we should be able to install a new site with some default values ex. a specific apppool with initial values. That part of the process is handled ok. Our problem is when updating the site then changes made to the configuration, ex. the "Idletime" in an apppool is changed back to the value specified in the installation. Basicly we dont want this configuration to change on updates.

I have seen that wix operates with a "ConfigureIfExists " = yes/no on the WebSite entity but that demands that the WebSite has a "Component" object as parent.

As an alternative we can read all existing parameters on the website and the apppool and use these for an upgrade - but there is a lot of theese parameters.

What is the right strategy in the above case.

May 21, 2015 at 2:11 AM
Edited May 21, 2015 at 2:50 AM
The current Wix# implementation inserts the WebSite element into Product element. Currently you have to deal with XML if you want to move it into Component element. It is relatively simple:
WebSite = new WebSite("DefaultWebSite", "*:80", "Default Web Site") { AttributesDefinition = "ConfigureIfExists=no" }
Compiler.WixSourceGenerated += doc =>
    var webSite = doc.Root.Descendants().Single(x=>x.Name.LocalName == "WebSite");
    var virtualDir = doc.Root.Descendants().Single(x => x.Name.LocalName == "WebVirtualDir");
However, please let me know if the technique works and having the WebSite element in Component is more beneficial and I will make it an out-of-box behavior.

BTW the next release will allow simplified XML manipulations via new Xml.Linq extensions:
project.Compiler.WixSourceGenerated + = doc =>
    var webSite = doc.FindSingle("WebSite");
    var virtualDir = doc.FindSingle("WebVirtualDir");