Microsoft.VisualStudio.Project.AssemblyReferenceNode.BindReferenceData C# (CSharp) Method

BindReferenceData() protected method

Links a reference node to the project and hierarchy.
protected BindReferenceData ( ) : void
return void
        protected override void BindReferenceData()
        {
            Debug.Assert(this.assemblyName != null, "The AssemblyName field has not been initialized");

            // If the item has not been set correctly like in case of a new reference added it now.
            // The constructor for the AssemblyReference node will create a default project item. In that case the Item is null.
            // We need to specify here the correct project element.
            if(this.ItemNode == null || this.ItemNode.Item == null)
            {
                this.ItemNode = new ProjectElement(this.ProjectMgr, this.assemblyName.FullName, ProjectFileConstants.Reference);
            }

            // Set the basic information we know about
            this.ItemNode.SetMetadata(ProjectFileConstants.Name, this.assemblyName.Name);
            if (!string.IsNullOrEmpty(this.assemblyPath))
            {
                this.ItemNode.SetMetadata(ProjectFileConstants.AssemblyName, Path.GetFileName(this.assemblyPath));
            }
            else
            {
                this.ItemNode.SetMetadata(ProjectFileConstants.AssemblyName, null);
            }

            this.SetReferenceProperties();
        }