private static void Project_WixSourceGenerated(System.Xml.Linq.XDocument doc) { doc.FindAll("Custom") .Where(x => x.HasAttribute("Action", "Set_ARPNOMODIFY")) .First() .SetAttribute("After", "InstallInitialize"); }
static void Compiler_WixSourceGenerated(System.Xml.Linq.XDocument document) { XElement aspxFileComponent = (from e in document.FindAll("File") where e.Attribute("Source").Value.EndsWith("Default.aspx") select e) .First() .Parent; string dirID = aspxFileComponent.Parent.Attribute("Id").Value; XNamespace ns = WixExtension.IIs.ToXNamespace(); aspxFileComponent.Add(new XElement(ns + "WebVirtualDir", new XAttribute("Id", "MyWebApp"), new XAttribute("Alias", "MyWebApp"), new XAttribute("Directory", dirID), new XAttribute("WebSite", "DefaultWebSite"), new XElement(ns + "WebApplication", new XAttribute("Id", "TestWebApplication"), new XAttribute("Name", "Test")))); document.Root.Select("Product") .Add(new XElement(ns + "WebSite", new XAttribute("Id", "DefaultWebSite"), new XAttribute("Description", "Default Web Site"), new XAttribute("Directory", dirID), new XElement(ns + "WebAddress", new XAttribute("Id", "AllUnassigned"), new XAttribute("Port", "80")))); }
static void Compiler_WixSourceGenerated(XDocument document) { //Will make MyApp.exe directory writable. //It is actually a bad practice to write to program files and this code is provided for sample purposes only. document.FindAll("Component") .Single(x => x.HasAttribute("Id", value=>value.EndsWith("MyApp.exe"))) .AddElement("CreateFolder/Permission", "User=Everyone;GenericAll=yes"); }
void Project_WixSourceGenerated(XDocument document) { var dir = document.FindAll("Directory") .Where(x => x.HasAttribute("Name", "Test Project") && x.Parent.HasAttribute("Name", "PersonalFolder")) .First(); var comp = dir.FindSingle("Component"); comp.AddElement("RemoveFolder", "On=uninstall; Id=" + dir.Attribute("Id").Value); comp.AddElement("RegistryValue", @"Root=HKCU; Key=Software\[Manufacturer]\[ProductName]; Type=string; Value=; KeyPath=yes"); }