/// <summary> /// Constructor to Wrap an existing MSBuild.ProjectItem /// Only have internal constructors as the only one who should be creating /// such object is the project itself (see Project.CreateFileNode()). /// </summary> /// <param name="project">Project that owns this item</param> /// <param name="existingItem">an MSBuild.ProjectItem; can be null if virtualFolder is true</param> /// <param name="virtualFolder">Is this item virtual (such as reference folder)</param> internal VirtualProjectElement(ProjectNode project, string path = null) : base(project) { _virtualProperties = new Dictionary<string, string>(); if(path != null) Rename(path); }
/// <summary> /// Constructor to Wrap an existing MSBuild.ProjectItem /// Only have internal constructors as the only one who should be creating /// such object is the project itself (see Project.CreateFileNode()). /// </summary> /// <param name="project">Project that owns this item</param> /// <param name="existingItem">an MSBuild.ProjectItem; can be null if virtualFolder is true</param> /// <param name="virtualFolder">Is this item virtual (such as reference folder)</param> internal MsBuildProjectElement(ProjectNode project, MSBuild.ProjectItem existingItem) : base(project) { Utilities.ArgumentNotNull("existingItem", existingItem); // Keep a reference to project and item _item = existingItem; }
/// <summary> /// Constructor for the ReferenceNode. It is called when the project is reloaded, when the project element representing the refernce exists. /// </summary> public ProjectReferenceNode(ProjectNode root, ProjectElement element) : base(root, element) { this.referencedProjectRelativePath = this.ItemNode.GetMetadata(ProjectFileConstants.Include); Debug.Assert(!String.IsNullOrEmpty(this.referencedProjectRelativePath), "Could not retrieve referenced project path form project file"); string guidString = this.ItemNode.GetMetadata(ProjectFileConstants.Project); // Continue even if project setttings cannot be read. try { this.referencedProjectGuid = new Guid(guidString); this.buildDependency = new BuildDependency(this.ProjectMgr, this.referencedProjectGuid); this.ProjectMgr.AddBuildDependency(this.buildDependency); } finally { Debug.Assert(this.referencedProjectGuid != Guid.Empty, "Could not retrive referenced project guidproject file"); this.referencedProjectName = this.ItemNode.GetMetadata(ProjectFileConstants.Name); Debug.Assert(!String.IsNullOrEmpty(this.referencedProjectName), "Could not retrive referenced project name form project file"); } // TODO: Maybe referenced projects should be relative to ProjectDir? this.referencedProjectFullPath = CommonUtils.GetAbsoluteFilePath(this.ProjectMgr.ProjectHome, this.referencedProjectRelativePath); }
/// <summary> /// Constructor for the AssemblyReferenceNode /// </summary> public AssemblyReferenceNode(ProjectNode root, string assemblyPath) : base(root) { // Validate the input parameters. if (null == root) { throw new ArgumentNullException("root"); } if (string.IsNullOrEmpty(assemblyPath)) { throw new ArgumentNullException("assemblyPath"); } this.InitializeFileChangeEvents(); // The assemblyPath variable can be an actual path on disk or a generic assembly name. if (File.Exists(assemblyPath)) { // The assemblyPath parameter is an actual file on disk; try to load it. this.assemblyName = System.Reflection.AssemblyName.GetAssemblyName(assemblyPath); this.assemblyPath = assemblyPath; // We register with listeningto chnages onteh path here. The rest of teh cases will call into resolving the assembly and registration is done there. this.fileChangeListener.ObserveItem(this.assemblyPath); } else { // The file does not exist on disk. This can be because the file / path is not // correct or because this is not a path, but an assembly name. // Try to resolve the reference as an assembly name. this.CreateFromAssemblyName(new System.Reflection.AssemblyName(assemblyPath)); } }
/// <summary> /// Constructor for IVSOutput2 implementation /// </summary> /// <param name="projectManager">Project that produce this output</param> /// <param name="outputAssembly">MSBuild generated item corresponding to the output assembly (by default, these would be of type MainAssembly</param> public Output(ProjectNode projectManager, ProjectItemInstance outputAssembly) { Utilities.ArgumentNotNull("projectManager", projectManager); project = projectManager; output = outputAssembly; }
internal WebPiReferenceNode(ProjectNode root, ProjectElement element, string filename, string productId, string friendlyName) : base(root, element) { Utilities.ArgumentNotNullOrEmpty("filename", filename); _feed = filename; _productId = productId; _friendlyName = friendlyName; }
private string _url; // cached Url /// <summary> /// Constructor to create a new MSBuild.ProjectItem and add it to the project /// Only have internal constructors as the only one who should be creating /// such object is the project itself (see Project.CreateFileNode()). /// </summary> internal MsBuildProjectElement(ProjectNode project, string itemPath, string itemType) : base(project) { Utilities.ArgumentNotNullOrEmpty("itemPath", itemPath); Utilities.ArgumentNotNullOrEmpty("itemType", itemType); // create and add the item to the project _item = project.BuildProject.AddItem(itemType, Microsoft.Build.Evaluation.ProjectCollection.Escape(itemPath))[0]; _url = base.Url; }
/// <summary> /// Constructor for IVSOutputGroup2 implementation /// </summary> /// <param name="outputName">Name of the output group. See VS_OUTPUTGROUP_CNAME_Build in vsshell.idl for the list of standard values</param> /// <param name="msBuildTargetName">MSBuild target name</param> /// <param name="projectManager">Project that produce this output</param> /// <param name="configuration">Configuration that produce this output</param> public OutputGroup(string outputName, string msBuildTargetName, ProjectNode projectManager, ProjectConfig configuration) { Utilities.ArgumentNotNull("outputName", outputName); Utilities.ArgumentNotNull("msBuildTargetName", msBuildTargetName); Utilities.ArgumentNotNull("projectManager", projectManager); Utilities.ArgumentNotNull("configuration", configuration); _name = outputName; _targetName = msBuildTargetName; _project = projectManager; _projectCfg = configuration; }
public UserProjectConfig(ProjectNode node) { string userConfigPath = node.Url + ".user"; try { LoadMsBuildProject(userConfigPath); } catch (InvalidProjectFileException) { File.WriteAllText(userConfigPath, emptyUserConfig); LoadMsBuildProject(userConfigPath); } this.proj = node; }
/// <summary> /// Constructor for the ReferenceNode /// </summary> public AssemblyReferenceNode(ProjectNode root, ProjectElement element) : base(root, element) { this.GetPathNameFromProjectFile(); this.InitializeFileChangeEvents(); if (File.Exists(assemblyPath)) { this.fileChangeListener.ObserveItem(this.assemblyPath); } string include = this.ItemNode.GetMetadata(ProjectFileConstants.Include); this.CreateFromAssemblyName(new System.Reflection.AssemblyName(include)); }
internal ProjectElement(ProjectNode project) { Utilities.ArgumentNotNull("project", project); _itemProject = project; }
internal CommonReferenceContainerNode(ProjectNode project) : base(project) { }
/// <summary> /// Constructor for the DependentFileNode /// </summary> /// <param name="root">Root of the hierarchy</param> /// <param name="e">Associated project element</param> internal DependentFileNode(ProjectNode root, MsBuildProjectElement element) : base(root, element) { this.HasParentNodeNameRelation = false; }
public OverwriteFileAddition(ProjectNode project, string targetFolder, DropEffect dropEffect, string sourceMoniker, string newFileName, IVsProject sourceHierarchy) : base(project, targetFolder, dropEffect, sourceMoniker, newFileName, sourceHierarchy) { }
public ReparentLinkedFileAddition(ProjectNode project, string targetFolder, string moniker) { Project = project; TargetFolder = targetFolder; Moniker = moniker; }
/// <summary> /// Defines if the node has a name relation to its parent node /// e.g. Form1.ext and Form1.resx are name related (until first occurence of extention separator) /// </summary> #endregion #region ctor /// <summary> /// Constructor for the DependentFileNode /// </summary> /// <param name="root">Root of the hierarchy</param> /// <param name="e">Associated project element</param> internal DependentFileNode(ProjectNode root, MsBuildProjectElement element) : base(root, element) { this.HasParentNodeNameRelation = false; }
internal BuildDependency(ProjectNode projectMgr, Guid projectReference) { this.referencedProjectGuid = projectReference; this.projectMgr = projectMgr; }
public ExtensibilityEventsDispatcher(ProjectNode /*!*/ project) { Utilities.ArgumentNotNull("project", project); this._project = project; }
/// <summary> /// Constructor for the FolderNode /// </summary> /// <param name="root">Root node of the hierarchy</param> /// <param name="relativePath">relative path from root i.e.: "NewFolder1\\NewFolder2\\NewFolder3</param> /// <param name="element">Associated project element</param> public FolderNode(ProjectNode root, ProjectElement element) : base(root, element) { }
internal CommonProjectNodeProperties(ProjectNode node) : base(node) { }
internal virtual OutputGroup CreateOutputGroup(ProjectNode project, KeyValuePair <string, string> group) { var outputGroup = new OutputGroup(group.Key, group.Value, project, this); return(outputGroup); }
public CommonProjectNodeProperties(ProjectNode node) : base(node) { }
internal ReferenceContainerNode(ProjectNode root) : base(root) { this.ExcludeNodeFromScc = true; }
/// <summary> /// Constructor to Wrap an existing MSBuild.ProjectItem /// Only have internal constructors as the only one who should be creating /// such object is the project itself (see Project.CreateFileNode()). /// </summary> /// <param name="project">Project that owns this item</param> /// <param name="existingItem">an MSBuild.ProjectItem; can be null if virtualFolder is true</param> /// <param name="virtualFolder">Is this item virtual (such as reference folder)</param> internal VirtualProjectElement(ProjectNode project) : base(project) { _virtualProperties = new Dictionary<string, string>(); }
/// <summary> /// Constructor for the FileNode /// </summary> /// <param name="root">Root of the hierarchy</param> /// <param name="e">Associated project element</param> public FileNode(ProjectNode root, ProjectElement element) : base(root, element) { UpdateCaption(); }
public ExtensibilityEventsDispatcher(ProjectNode/*!*/ project) { Utilities.ArgumentNotNull("project", project); this._project = project; }
public FolderAddition(ProjectNode project, string newFolderPath, string sourceFolder, DropEffect dropEffect, Addition[] additions) { Project = project; NewFolderPath = newFolderPath; SourceFolder = sourceFolder; Additions = additions; DropEffect = dropEffect; }
internal TrackDocumentsHelper(ProjectNode project) { this.projectMgr = project; }
internal ProjectConfig(ProjectNode project, string configuration) { this.project = project; if (configuration.Contains("|")) { // If configuration is in the form "<Configuration>|<Platform>" string[] configStrArray = configuration.Split('|'); if (2 == configStrArray.Length) { this.configName = configStrArray[0]; this.platformName = configStrArray[1]; } else { throw new Exception(string.Format(CultureInfo.InvariantCulture, "Invalid configuration format: {0}", configuration)); } } else { // If configuration is in the form "<Configuration>" this.configName = configuration; } var flavoredCfgProvider = ProjectMgr.GetOuterInterface<IVsProjectFlavorCfgProvider>(); Utilities.ArgumentNotNull("flavoredCfgProvider", flavoredCfgProvider); ErrorHandler.ThrowOnFailure(flavoredCfgProvider.CreateProjectFlavorCfg(this, out flavoredCfg)); Utilities.ArgumentNotNull("flavoredCfg", flavoredCfg); // if the flavored object support XML fragment, initialize it IPersistXMLFragment persistXML = flavoredCfg as IPersistXMLFragment; if (null != persistXML) { this.project.LoadXmlFragment(persistXML, configName, platformName); } }
/// <summary> /// constructor for the ReferenceNode /// </summary> protected ReferenceNode(ProjectNode root, ProjectElement element) : base(root, element) { this.ExcludeNodeFromScc = true; }
public ConfigProvider(ProjectNode manager) { this.project = manager; }
public FileAddition(ProjectNode project, string targetFolder, DropEffect dropEffect, string sourceMoniker, string newFileName, IVsProject sourceHierarchy) { Project = project; TargetFolder = targetFolder; DropEffect = dropEffect; SourceMoniker = sourceMoniker; SourceHierarchy = sourceHierarchy; NewFileName = newFileName; }
public ProjectReferenceFileAdder(ProjectNode project, HierarchyNode targetNode, string[] projectReferences, bool mouseDropping, DropEffect dropEffect) { Utilities.ArgumentNotNull("targetNode", targetNode); Utilities.ArgumentNotNull("project", project); Utilities.ArgumentNotNull("projectReferences", projectReferences); TargetNode = targetNode; Project = project; ProjectReferences = projectReferences; MouseDropping = mouseDropping; DropEffect = dropEffect; }
public ConfigProvider(ProjectNode manager) { this.ProjectMgr = manager; }
internal virtual OutputGroup CreateOutputGroup(ProjectNode project, KeyValuePair<string, string> group) { OutputGroup outputGroup = new OutputGroup(group.Key, group.Value, project, this); return outputGroup; }
public ProjectDesignerDocumentManager(ProjectNode node) : base(node) { }
private PythonProjectReferenceNode(ProjectNode project, string referencedProjectName, string projectPath, string projectReference) : base(project, referencedProjectName, projectPath, projectReference) { }
internal ProjectNodeProperties(ProjectNode node) : base(node) { }
/// <summary> /// constructor for the ProjectReferenceNode /// </summary> public ProjectReferenceNode(ProjectNode root, string referencedProjectName, string projectPath, string projectReference) : base(root) { Debug.Assert(root != null && !String.IsNullOrEmpty(referencedProjectName) && !String.IsNullOrEmpty(projectReference) && !String.IsNullOrEmpty(projectPath), "Can not add a reference because the input for adding one is invalid."); if (projectReference == null) { throw new ArgumentNullException("projectReference"); } this.referencedProjectName = referencedProjectName; int indexOfSeparator = projectReference.IndexOf('|'); string fileName = String.Empty; // Unfortunately we cannot use the path part of the projectReference string since it is not resolving correctly relative pathes. if (indexOfSeparator != -1) { string projectGuid = projectReference.Substring(0, indexOfSeparator); this.referencedProjectGuid = new Guid(projectGuid); if (indexOfSeparator + 1 < projectReference.Length) { string remaining = projectReference.Substring(indexOfSeparator + 1); indexOfSeparator = remaining.IndexOf('|'); if (indexOfSeparator == -1) { fileName = remaining; } else { fileName = remaining.Substring(0, indexOfSeparator); } } } Debug.Assert(!String.IsNullOrEmpty(fileName), "Can not add a project reference because the input for adding one is invalid."); string justTheFileName = Path.GetFileName(fileName); this.referencedProjectFullPath = CommonUtils.GetAbsoluteFilePath(projectPath, justTheFileName); // TODO: Maybe referenced projects should be relative to ProjectDir? this.referencedProjectRelativePath = CommonUtils.GetRelativeFilePath(this.ProjectMgr.ProjectHome, this.referencedProjectFullPath); this.buildDependency = new BuildDependency(this.ProjectMgr, this.referencedProjectGuid); }
/// <summary> /// Constructor to Wrap an existing MSBuild.ProjectItem /// Only have internal constructors as the only one who should be creating /// such object is the project itself (see Project.CreateFileNode()). /// </summary> /// <param name="project">Project that owns this item</param> /// <param name="existingItem">an MSBuild.ProjectItem; can be null if virtualFolder is true</param> /// <param name="virtualFolder">Is this item virtual (such as reference folder)</param> internal VirtualProjectElement(ProjectNode project) : base(project) { _virtualProperties = new Dictionary <string, string>(); }