protected override ReferenceNode CreateFileComponent(VSCOMPONENTSELECTORDATA selectorData)
        {
            if (!File.Exists(selectorData.bstrFile))
            {
                return(null);
            }

            WixProjectNode projectNode = this.ProjectMgr as WixProjectNode;

            WixHelperMethods.ShipAssert(projectNode != null, "ProjectMgr is null or is not WixProjectNode.");

            switch (Path.GetExtension(selectorData.bstrFile))
            {
            case ".wixlib":
                return(new WixLibraryReferenceNode(projectNode, projectNode.GetRelativePath(selectorData.bstrFile)));

            case ".dll":
                return(new WixExtensionReferenceNode(projectNode, selectorData.bstrFile));

            default:
                string message = String.Format(CultureInfo.CurrentUICulture, WixStrings.WixReferenceInvalid, selectorData.bstrFile);
                WixHelperMethods.ShowErrorMessageBox(this.ProjectMgr.Site, message);
                return(null);
            }
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="WixExtensionReferenceNode"/> class.
        /// </summary>
        /// <param name="root">The root <see cref="WixProjectNode"/> that contains this node.</param>
        /// <param name="referencePath">The path to the wixlib reference file.</param>
        public WixExtensionReferenceNode(WixProjectNode root, string referencePath)
            : base(root, referencePath, WixProjectFileConstants.WixExtension)
        {
            referencePath = WixHelperMethods.ReplacePathWithBuildProperty(referencePath, ExtensionDirectoryToken, this.ExtensionDirectory);

            if (!referencePath.StartsWith(ExtensionDirectoryToken, StringComparison.Ordinal) && null != root)
            {
                referencePath = root.GetRelativePath(referencePath);
            }

            this.ItemNode.SetMetadata(ProjectFileConstants.HintPath, referencePath);

            this.InitializeFileChangeEvents();
        }