Wix# wrapper around T:System.Guid. WixGuid allows generation of continuous GUIDs for for composing reproducible WiX source files.
Inheritance: WixObject
Ejemplo n.º 1
0
        /// <summary>
        /// Adds itself as an XML content into the WiX source being generated from the <see cref="WixSharp.Project" />.
        /// See 'Wix#/samples/Extensions' sample for the details on how to implement this interface correctly.
        /// </summary>
        /// <param name="context">The context.</param>
        public void Process(ProcessingContext context)
        {
            XNamespace ns    = "http://schemas.microsoft.com/wix/IIsExtension";
            var        dirId = context.XParent.Attribute("Id").Value;

            var componentId = $"{Description}.Component.Id";
            var component   = new XElement(XName.Get("Component"),
                                           new XAttribute("Id", componentId),
                                           new XAttribute("Guid", WixGuid.NewGuid(componentId)),
                                           new XAttribute("KeyPath", "yes"));

            context.XParent.Add(component);

            var webAppPoolId = $"{Description}.WebAppPool.Id";

            component.Add(new XElement(ns + "WebAppPool",
                                       new XAttribute("Id", webAppPoolId),
                                       new XAttribute("Name", Description),
                                       new XAttribute("Identity", "localSystem")));

            component.Add(new XElement(ns + "WebSite",
                                       new XAttribute("Id", $"{Description}.WebSite.Id"),
                                       new XAttribute("Description", Description),
                                       new XAttribute("Directory", dirId),
                                       new XElement(ns + "WebAddress",
                                                    new XAttribute("Id", "AllUnassigned"),
                                                    new XAttribute("Port", Port)),
                                       new XElement(ns + "WebApplication",
                                                    new XAttribute("Id", $"{Description}.WebSiteApplication.Id"),
                                                    new XAttribute("WebAppPool", webAppPoolId),
                                                    new XAttribute("Name", Description))));
        }
Ejemplo n.º 2
0
        static XElement CrteateComponentFor(this XDocument doc, XElement xDir)
        {
            string   compId     = xDir.Attribute("Id").Value;
            XElement xComponent = xDir.AddElement(
                new XElement("Component",
                             new XAttribute("Id", compId),
                             new XAttribute("Guid", WixGuid.NewGuid(compId))));

            foreach (XElement xFeature in doc.Root.Descendants("Feature"))
            {
                xFeature.Add(new XElement("ComponentRef",
                                          new XAttribute("Id", xComponent.Attribute("Id").Value)));
            }

            return(xComponent);
        }
Ejemplo n.º 3
0
 /// <summary>
 /// Calculates the product id.
 /// </summary>
 /// <param name="productGuid">The product GUID.</param>
 /// <param name="version">The version.</param>
 /// <returns></returns>
 public static Guid CalculateProductId(Guid productGuid, Version version)
 {
     return(WixGuid.HashGuidByInteger(productGuid, version.GetHashCode() + 1));
 }
Ejemplo n.º 4
0
 /// <summary>
 /// Default GUID generation algorithm.
 /// </summary>
 /// <param name="seed">The seed.</param>
 /// <returns></returns>
 public static Guid Default(object seed)
 {
     return(WixGuid.HashGuidByInteger(WixGuid.ConsistentGenerationStartValue.CurrentGuid, seed.ToString().GetHashCode32()));
 }