Exemple #1
0
        /// <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));
            }
        }
Exemple #2
0
 internal WebPiReferenceNode(ProjectNode root, ProjectElement element, string filename, string productId, string friendlyName)
     : base(root, element)
 {
     _feed = filename;
     _productId = productId;
     _friendlyName = friendlyName;
 }
Exemple #3
0
        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);
        }
Exemple #4
0
        /// <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;
        }
Exemple #5
0
        /// <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;
        }
Exemple #6
0
        /// <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, string relativePath, ProjectElement element)
            : base(root, element)
        {
            Utilities.ArgumentNotNull("relativePath", relativePath);

            if (Path.IsPathRooted(relativePath))
            {
                relativePath = CommonUtils.GetRelativeDirectoryPath(root.ProjectHome, relativePath);
            }

            this.VirtualNodeName = CommonUtils.TrimEndSeparator(relativePath);
        }
Exemple #7
0
        /// <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];
            ItemProject.SetProjectFileDirty(true);
            RefreshProperties();
        }
Exemple #8
0
        /// <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;
        }
Exemple #9
0
        /// <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));
        }
Exemple #10
0
        internal ProjectElement(ProjectNode project)
        {
            Utilities.ArgumentNotNull("project", project);

            _itemProject = project;
        }
 public CommonProjectNodeProperties(ProjectNode node)
     : base(node)
 {
 }
Exemple #12
0
 /// <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>();
 }
Exemple #13
0
 public JProjectReferenceNode(ProjectNode root, ProjectElement element)
     : base(root, element)
 {
     _fileChangeListener = new FileChangeManager(ProjectMgr.Site);
     Initialize();
 }
Exemple #14
0
 protected virtual OutputGroup CreateOutputGroup(ProjectNode project, KeyValuePair<string, string> group)
 {
     OutputGroup outputGroup = new OutputGroup(group.Key, group.Value, project, this);
     return outputGroup;
 }
Exemple #15
0
 public ProjectNodeProperties(ProjectNode node)
     : base(node)
 {
 }
Exemple #16
0
 internal WebPiReferenceNode(ProjectNode root, string filename, string productId, string friendlyName)
     : this(root, null, filename, productId, friendlyName)
 {
 }
Exemple #17
0
 public ReferenceContainerNode(ProjectNode root)
     : base(root)
 {
     this.VirtualNodeName = ReferencesNodeVirtualName;
     this.ExcludeNodeFromScc = true;
 }
Exemple #18
0
 /// <summary>
 /// constructor for the ReferenceNode
 /// </summary>
 protected ReferenceNode(ProjectNode root)
     : base(root)
 {
     this.ExcludeNodeFromScc = true;
 }
 public CommonReferenceContainerNode(ProjectNode project)
     : base(project)
 {
 }
 public ProjectDesignerDocumentManager(ProjectNode node)
     : base(node)
 {
 }
Exemple #21
0
 /// <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, MsBuildProjectElement element)
     : base(root, element)
 {
     if (this.ProjectMgr.NodeHasDesigner(this.ItemNode.GetMetadata(ProjectFileConstants.Include)))
     {
         this.HasDesigner = true;
     }
 }
Exemple #22
0
 public BuildDependency(ProjectNode projectMgr, Guid projectReference)
 {
     this.referencedProjectGuid = projectReference;
     this.projectMgr = projectMgr;
 }
Exemple #23
0
        public ProjectConfig(ProjectNode project, string configuration)
        {
            this.project = project;
            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);
            }
        }
Exemple #24
0
 public ConfigProvider(ProjectNode manager)
 {
     this.project = manager;
 }
Exemple #25
0
 /// <summary>
 /// Constructor for the DependentFileNode
 /// </summary>
 /// <param name="root">Root of the hierarchy</param>
 /// <param name="e">Associated project element</param>
 public DependentFileNode(ProjectNode root, MsBuildProjectElement element)
     : base(root, element)
 {
     this.HasParentNodeNameRelation = false;
 }
Exemple #26
0
        /// <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);
        }
Exemple #27
0
 public JProjectReferenceNode(ProjectNode project, string referencedProjectName, string projectPath, string projectReference)
     : base(project, referencedProjectName, projectPath, projectReference)
 {
     _fileChangeListener = new FileChangeManager(ProjectMgr.Site);
     Initialize();
 }
Exemple #28
0
 internal TrackDocumentsHelper(ProjectNode project)
 {
     this.projectMgr = project;
 }