protected internal override bool IsAlreadyAdded(out ReferenceNode existingReference)
{
ReferenceContainerNode referencesFolder = this.ProjectMgr.FindChild(ReferenceContainerNode.ReferencesNodeVirtualName) as ReferenceContainerNode;
Debug.Assert(referencesFolder != null, "Could not find the References node");
bool shouldCheckPath = !string.IsNullOrEmpty(this.Url);
for(HierarchyNode n = referencesFolder.FirstChild; n != null; n = n.NextSibling)
{
AssemblyReferenceNode assemblyReferenceNode = n as AssemblyReferenceNode;
if(null != assemblyReferenceNode)
{
// We will check if the full assemblynames are the same or if the Url of the assemblies is the same.
if(String.Compare(assemblyReferenceNode.AssemblyName.FullName, this.assemblyName.FullName, StringComparison.OrdinalIgnoreCase) == 0 ||
(shouldCheckPath && NativeMethods.IsSamePath(assemblyReferenceNode.Url, this.Url)))
{
existingReference = assemblyReferenceNode;
return true;
}
}
}
existingReference = null;
return false;
}