Could not understand, where error
Xsd:
<?xml version="1.0" encoding="utf-8"?>
<xs:schema
    xmlns:xs="http://www.w3.org/2001/XMLSchema";
    xmlns:xse="http://schemas.microsoft.com/wix/2005/XmlSchemaExtension";
    targetNamespace="http://schemas.www.stc-spb.ru/wix/InterBaseExtension";
>
  <xs:annotation>
    <xs:documentation>
    </xs:documentation>
  </xs:annotation>

  <xs:import namespace="http://schemas.microsoft.com/wix/2006/wi"; />
  
  <xs:element name="IB">
    <xs:annotation>
      <xs:documentation>
      </xs:documentation>
      <xs:appinfo>
        <xse:parent namespace="http://schemas.microsoft.com/wix/2006/wi";
ref="Component" />
      </xs:appinfo>
    </xs:annotation>

    <xs:complexType>
      <xs:attribute name="Id" type="xs:string" use="required">
        <xs:annotation>
          <xs:documentation>
          </xs:documentation>
        </xs:annotation>
      </xs:attribute>

    </xs:complexType>
  </xs:element>

</xs:schema>


WixIBExtension.cs:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Tools.WindowsInstallerXml;

namespace WixIBExtension
{
    public class WixIBExtension : WixExtension
    {
        private IBCompiler FIBCompiler;

        public override CompilerExtension CompilerExtension
        {
            get
            {
                if (this.FIBCompiler == null)
                {
                    this.FIBCompiler = new IBCompiler();
                }
                return this.FIBCompiler;
            }
        }
    }
}


IBCompiler.cs:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Tools.WindowsInstallerXml;
using System.Xml;
using System.Xml.Schema;
using System.Reflection;

namespace WixIBExtension
{
    class IBCompiler : CompilerExtension
    {
        private XmlSchema schema;

        public IBCompiler()
        {
            this.schema =
LoadXmlSchemaHelper(Assembly.GetExecutingAssembly(),
"Microsoft.Tools.WindowsInstallerXml.Extensions.Xsd.InterBase.xsd");
        }

        public override XmlSchema Schema
        {
            get { return this.schema; }
        }

        public override void ParseElement(SourceLineNumberCollection
sourceLineNumbers, XmlElement parentElement, XmlElement element, params
string[] contextValues)
        {
            switch (parentElement.LocalName)
            {
                case "Component":
                    if (element.LocalName == "IB")
                        this.ParseIBExtensionElement(element);
                    else
                        this.Core.UnexpectedElement(parentElement, element);
                    break;
                default:
                    this.Core.UnexpectedElement(parentElement, element);
                    break;
            }
        }

        private void ParseIBExtensionElement(XmlNode node)
        {
        }
    }
}


When runnig I get an exception at IBCompiler() constructor:
NullReferenceException "Object reference not set to an instance of an
object."
-- 
View this message in context: 
http://windows-installer-xml-wix-toolset.687559.n2.nabble.com/Writing-own-Wix-Extension-tp4968486p4978794.html
Sent from the wix-users mailing list archive at Nabble.com.

------------------------------------------------------------------------------
_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users

Reply via email to