/// <summary> /// Creates an assembly refernce node from a project element. /// </summary> internal virtual AssemblyReferenceNode CreateAssemblyReferenceNode(ProjectElement element, BuildResult buildResult) { AssemblyReferenceNode node = null; try { node = AssemblyReferenceNode.CreateFromProjectFile(this.ProjectMgr, element, buildResult); } catch (ArgumentNullException e) { Trace.WriteLine("Exception : " + e.Message); } catch (FileNotFoundException e) { Trace.WriteLine("Exception : " + e.Message); } catch (BadImageFormatException e) { Trace.WriteLine("Exception : " + e.Message); } catch (FileLoadException e) { Trace.WriteLine("Exception : " + e.Message); } catch (System.Security.SecurityException e) { Trace.WriteLine("Exception : " + e.Message); } return(node); }
private void SetProjectItemsThatRelyOnReferencesToBeResolved(bool renameItemNode) { // Call MSBuild to build the target ResolveComReferences bool success; ErrorHandler.ThrowOnFailure(this.ProjectMgr.BuildTarget(MsBuildTarget.ResolveComReferences, out success)); if (!success) { throw new InvalidOperationException(); } // Now loop through the generated COM References to find the corresponding one var instance = this.ProjectMgr.BuildProject.CreateProjectInstance(); AssemblyReferenceNode.BuildInstance(this.ProjectMgr, ref instance, MsBuildTarget.ResolveAssemblyReferences); var comReferences = instance.GetItems(MsBuildGeneratedItemType.ComReferenceWrappers); foreach (var reference in comReferences) { if (String.Compare(MSBuildItem.GetMetadataValue(reference, ProjectFileConstants.Guid), this.typeGuid.ToString("B"), StringComparison.OrdinalIgnoreCase) == 0 && String.Compare(MSBuildItem.GetMetadataValue(reference, ProjectFileConstants.VersionMajor), this.majorVersionNumber, StringComparison.OrdinalIgnoreCase) == 0 && String.Compare(MSBuildItem.GetMetadataValue(reference, ProjectFileConstants.VersionMinor), this.minorVersionNumber, StringComparison.OrdinalIgnoreCase) == 0 && String.Compare(MSBuildItem.GetMetadataValue(reference, ProjectFileConstants.Lcid), this.lcid, StringComparison.OrdinalIgnoreCase) == 0) { string name = MSBuildItem.GetEvaluatedInclude(reference); if (Path.IsPathRooted(name)) { this.projectRelativeFilePath = name; } else { this.projectRelativeFilePath = Path.Combine(this.ProjectMgr.ProjectFolder, name); } if (renameItemNode) { this.ItemNode.Rename(Path.GetFileNameWithoutExtension(name)); } break; } } }
/// <summary> /// Creates an assembly reference node from a file path. /// </summary> internal virtual AssemblyReferenceNode CreateAssemblyReferenceNode(string assemblyInclude, AddReferenceDialogTab tab, bool isFullPath) { AssemblyReferenceNode node = null; try { if (isFullPath) { node = AssemblyReferenceNode.CreateFromFullPathViaUIAddReference(this.ProjectMgr, assemblyInclude, tab); } else { node = AssemblyReferenceNode.CreateFromAssemblyNameViaUIAutomation(this.ProjectMgr, assemblyInclude); } } catch (ArgumentNullException e) { Trace.WriteLine("Exception : " + e.Message); } catch (FileNotFoundException e) { Trace.WriteLine("Exception : " + e.Message); } catch (BadImageFormatException e) { Trace.WriteLine("Exception : " + e.Message); } catch (FileLoadException e) { Trace.WriteLine("Exception : " + e.Message); } catch (System.Security.SecurityException e) { Trace.WriteLine("Exception : " + e.Message); } return(node); }
internal AssemblyReferenceProperties(AssemblyReferenceNode node, bool copyLocalDefault) : base(node, copyLocalDefault) { }