Quantcast
Channel: wixsharp Discussions Rss Feed
Viewing all articles
Browse latest Browse all 1354

New Post: Updating a website

$
0
0
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");
    webSite.Remove();
    virtualDir.Parent.Add(webSite);
};
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");
    webSite.MoveTo(virtualDir.Parent);
};

Viewing all articles
Browse latest Browse all 1354

Trending Articles