protected override string CalculateMsiId()
        {
            InprocServer  inprocServer  = this.Item as InprocServer;
            OutprocServer outprocServer = this.Item as OutprocServer;
            Class         firstClass    = this.inproc ? inprocServer.Classes[0] : outprocServer.Classes[0];

            string key = this.GetKey(firstClass.Id);
            string id  = WixBackendCompilerServices.GenerateIdForRegKey(this.Backend, this.Item, 0, key, null);

            return(id);
        }
        public override void GenerateSectionRowsForComponent(WixSection section, string componentId)
        {
            InprocServer  inprocServer  = this.Item as InprocServer;
            OutprocServer outprocServer = this.Item as OutprocServer;

            IEnumerable <Class> classes = this.inproc ? inprocServer.Classes : outprocServer.Classes;

            foreach (Class classId in classes)
            {
                File    fileItem    = this.inproc ? inprocServer.File : outprocServer.File;
                WixItem msiFileItem = this.Backend.WixItems[fileItem];

                string guidClassId = new Guid(classId.Id).ToString("B").ToUpperInvariant();
                string key         = this.GetKey(guidClassId);

                string value = String.Concat("[#", msiFileItem.MsiId, "]");
                if (!this.inproc && !String.IsNullOrWhiteSpace(outprocServer.Arguments))
                {
                    value = String.Concat("\"", value, "\" ", outprocServer.Arguments);
                }

                string msiId = WixBackendCompilerServices.GenerateIdForRegKey(this.Backend, null, 0, key, null);
                WixBackendCompilerServices.GenerateRow(section, "Registry", this.Item.LineNumber,
                                                       msiId,        // Id
                                                       0,            // HKCR
                                                       key,          // Key
                                                       null,         // Name
                                                       value,        // Value
                                                       componentId); // Component

                string threadingModel = ConvertThreadingModel(classId.ThreadingModel);

                msiId = WixBackendCompilerServices.GenerateIdForRegKey(this.Backend, null, 0, key, "ThreadingModel");
                WixBackendCompilerServices.GenerateRow(section, "Registry", this.Item.LineNumber,
                                                       msiId,            // Id
                                                       0,                // HKCR
                                                       key,              // Key
                                                       "ThreadingModel", // Name
                                                       threadingModel,   // Value
                                                       componentId);     // Component

                if (!String.IsNullOrEmpty(classId.Implementation))
                {
                    key   = String.Concat("CLSID\\", guidClassId, "\\ProgID");
                    msiId = WixBackendCompilerServices.GenerateIdForRegKey(this.Backend, null, 0, key, null);
                    WixBackendCompilerServices.GenerateRow(section, "Registry", this.Item.LineNumber,
                                                           msiId,                  // Id
                                                           0,                      // HKCR
                                                           key,                    // Key
                                                           null,                   // Name
                                                           classId.Implementation, // Value
                                                           componentId);           // Component

                    key   = String.Concat(classId.Implementation, "\\CLSID");
                    msiId = WixBackendCompilerServices.GenerateIdForRegKey(this.Backend, null, 0, key, null);
                    WixBackendCompilerServices.GenerateRow(section, "Registry", this.Item.LineNumber,
                                                           msiId,        // Id
                                                           0,            // HKCR
                                                           key,          // Key
                                                           null,         // Name
                                                           guidClassId,  // Value
                                                           componentId); // Component
                }
            }
        }