Exemple #1
0
        public override WixSection GenerateSection()
        {
            if (this.System)
            {
                return(null);
            }

            File    file          = (File)this.Item;
            WixItem folderMsiItem = WixBackendCompilerServices.ResolveParentFolderMsiItem(file.ParentFolder, this.Backend.WixItems);

            if (folderMsiItem == null)
            {
                return(null);
            }

            string componentId = this.ComponentMsiId;
            int    attributes  = this.Backend.Architecture == PackageArchitecture.X64 ? 256 : 0;
            string condition   = WixBackendCompilerServices.GenerateMsiCondition(this);

            if (!String.IsNullOrEmpty(condition))
            {
                attributes |= 64; // mark Component transitive when there is a condition.
            }

            WixSection section = new WixSection(this.MsiId, "fragment", this.Item.LineNumber);

            WixBackendCompilerServices.GenerateRow(section, "Component", this.Item.LineNumber,
                                                   componentId,         // Id
                                                   "*",                 // Guid
                                                   folderMsiItem.MsiId, // Directory
                                                   attributes,          // Attributes
                                                   condition,           // Condition
                                                   this.MsiId);         // KeyPath

            this.GenerateSectionRowsForComponent(section, componentId);

            WixBackendCompilerServices.GenerateSimpleReference(section, "Directory", this.Item.LineNumber, folderMsiItem.MsiId);
            WixBackendCompilerServices.GenerateSimpleReference(section, "Media", this.Item.LineNumber, "1");

            foreach (ITargetFile targetFileItem in file.Items)
            {
                File childsFile = targetFileItem.GetTargetedFile();
                if (childsFile == file)
                {
                    WixItem item = this.Backend.WixItems[(PackageItem)targetFileItem];
                    item.GenerateSectionRowsForComponent(section, componentId);
                }
            }

            return(section);
        }
        public override WixSection GenerateSection()
        {
            if (this.System)
            {
                return(null);
            }

            InprocServer  inprocServer  = this.Item as InprocServer;
            OutprocServer outprocServer = this.Item as OutprocServer;

            File file = this.inproc ? inprocServer.File : outprocServer.File;

            if (file == this.Item.Parent)
            {
                return(null);
            }

            WixItem folderMsiItem = WixBackendCompilerServices.ResolveParentFolderMsiItem(file.ParentFolder, this.Backend.WixItems);

            if (folderMsiItem == null)
            {
                return(null);
            }

            string componentId = this.ComponentMsiId;
            int    attributes  = this.Backend.Architecture == PackageArchitecture.X64 ? 260 : 4;
            string condition   = WixBackendCompilerServices.GenerateMsiCondition(this);

            if (!String.IsNullOrEmpty(condition))
            {
                attributes |= 64; // mark Component transitive when there is a condition.
            }

            WixSection section = new WixSection(this.MsiId, "fragment", this.Item.LineNumber);

            WixBackendCompilerServices.GenerateRow(section, "Component", this.Item.LineNumber,
                                                   componentId,         // Id
                                                   "*",                 // Guid
                                                   folderMsiItem.MsiId, // Directory
                                                   attributes,          // Attributes
                                                   condition,           // Condition
                                                   this.MsiId);         // KeyPath

            this.GenerateSectionRowsForComponent(section, componentId);

            return(section);
        }