NewGuid() 공개 정적인 메소드

Returns new GUID.
public static NewGuid ( ) : System.Guid
리턴 System.Guid
예제 #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))));
        }
예제 #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);
        }