Beispiel #1
0
        /// <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 retrive 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");
            }

            Uri uri = new Uri(this.ProjectMgr.BaseURI.Uri, this.referencedProjectRelativePath);

            if (uri != null)
            {
                this.referencedProjectFullPath = Microsoft.VisualStudio.Shell.Url.Unescape(uri.LocalPath, true);
            }
        }
Beispiel #2
0
        // =========================================================================================
        // Constructors
        // =========================================================================================

        /// <summary>
        /// Initializes a new instance of the <see cref="WixReferenceNode"/> class.
        /// </summary>
        /// <param name="root">The root <see cref="WixProjectNode"/> that contains this node.</param>
        /// <param name="element">The element that contains MSBuild properties.</param>
        protected WixReferenceNode(WixProjectNode root, ProjectElement element)
            : base(root, element)
        {
            string includeValue = this.ItemNode.GetMetadata(ProjectFileConstants.Include);
            bool referenceNameNotPresent = String.IsNullOrEmpty(this.ItemNode.GetMetadata(ProjectFileConstants.Name));
            string newReferenceName = includeValue;

            if (String.IsNullOrEmpty(this.ItemNode.GetMetadata(ProjectFileConstants.HintPath)))
            {
                this.ItemNode.SetMetadata(ProjectFileConstants.HintPath, includeValue);
            }

            if (includeValue.Contains(Path.DirectorySeparatorChar.ToString()))
            {
                this.ItemNode.Rename(Path.GetFileNameWithoutExtension(includeValue));
                newReferenceName = Path.GetFileNameWithoutExtension(includeValue);
            }

            if (referenceNameNotPresent)
            {
                // this will fail if the node was included from a targets file
                try
                {
                    this.ItemNode.SetMetadata(ProjectFileConstants.Name, newReferenceName);
                }
                catch
                {
                }
            }
        }
Beispiel #3
0
        /// <include file='doc\HierarchyItem.uex' path='docs/doc[@for="HierarchyItemNode.HierarchyItemNode"]/*' />
        /// <summary>
        /// constructor for the HierarchyItemNode
        /// </summary>
        /// <param name="root"></param>
        /// <param name="type"></param>
        /// <param name="strDirectoryPath"></param>
        public HierarchyItemNode(Project root, HierarchyNodeType type, ProjectElement e)
		{
            this.projectMgr = root;
            this.nodeType = type;
			this.itemNode = e;
			this.hierarchyId = this.projectMgr.ItemIdMap.Add(this);
        }
        public WixFolderNode(WixProjectNode root, string directoryPath, ProjectElement element, bool isNonMemberItem)
            : base(root, directoryPath, element)
        {
            this.isNonMemberItem = isNonMemberItem;

            // Folders do not participate in SCC.
            base.ExcludeNodeFromScc = true;
        }
        /// <summary>
        /// Constructor for the ReferenceNode
        /// </summary>
        public AssemblyReferenceNode(ProjectNode root, ProjectElement e)
            : base(root, e)
        {
            this.GetPathNameFromProjectFile();

            string include = this.ItemNode.GetMetadata(ProjectFileConstants.Include);

            CreateFromAssemblyName(new System.Reflection.AssemblyName(include));
        }
Beispiel #6
0
        /// <summary>
        /// Constructor for IVSOutput2 implementation
        /// </summary>
        /// <param name="projectManager">Project that produce this output</param>
        /// <param name="configuration">Configuration 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, ProjectConfig configuration, ProjectElement outputAssembly)
        {
            if (projectManager == null)
                throw new ArgumentNullException("projectManager");
            if (configuration == null)
                throw new ArgumentNullException("configuration");
            if (outputAssembly == null)
                throw new ArgumentNullException("outputAssembly");

            project = projectManager;
            projectCfg = configuration;
            output = outputAssembly;
        }
        /// <summary>
        /// Constructor for the ComReferenceNode. 
        /// </summary>
        public ComReferenceNode(ProjectNode root, ProjectElement element)
            : base(root, element)
        {
            this.typeName = this.ItemNode.GetMetadata(ProjectFileConstants.Include);
            string typeGuidAsString = this.ItemNode.GetMetadata(ProjectFileConstants.Guid);
            if (typeGuidAsString != null)
            {
                this.typeGuid = new Guid(typeGuidAsString);
            }

            this.majorVersionNumber = this.ItemNode.GetMetadata(ProjectFileConstants.VersionMajor);
            this.minorVersionNumber = this.ItemNode.GetMetadata(ProjectFileConstants.VersionMinor);
            this.lcid = this.ItemNode.GetMetadata(ProjectFileConstants.Lcid);
            this.SetProjectItemsThatRelyOnReferencesToBeResolved(false);
            this.SetInstalledFilePath();
        }
Beispiel #8
0
        protected virtual ReferenceNode CreateReferenceNode(string referenceType, ProjectElement element)
        {
            ReferenceNode node = null;
            if (referenceType == ProjectFileConstants.COMReference)
            {
                node = this.CreateComReferenceNode(element);
            }
            else if (referenceType == ProjectFileConstants.Reference)
            {
                node = this.CreateAssemblyReferenceNode(element);
            }
            else if (referenceType == ProjectFileConstants.ProjectReference)
            {
                node = this.CreateProjectReferenceNode(element);
            }

            return node;
        }
Beispiel #9
0
 /// <summary>
 /// Creates a com reference node from the project element.
 /// </summary>
 protected virtual ComReferenceNode CreateComReferenceNode(ProjectElement reference)
 {
     return new ComReferenceNode(this.ProjectMgr, reference);
 }
        /// <summary>
        /// Adds references to this container from a MSBuild project.
        /// </summary>
        public void LoadReferencesFromBuildProject(MSBuild.Project buildProject)
        {
            foreach (string referenceType in SupportedReferenceTypes)
            {
                MSBuild.BuildItemGroup refererncesGroup = buildProject.GetEvaluatedItemsByName(referenceType);

                bool isAssemblyReference = referenceType == ProjectFileConstants.Reference;
                // If the project was loaded for browsing we should still create the nodes but as not resolved.
                if (this.ProjectMgr.HasPassedSecurityChecks && isAssemblyReference && this.ProjectMgr.Build(MsBuildTarget.ResolveAssemblyReferences) != MSBuildResult.Successful)
                {
                    continue;
                }

                foreach (MSBuild.BuildItem item in refererncesGroup)
                {
                    ProjectElement element = new ProjectElement(this.ProjectMgr, item, false);

                    ReferenceNode node = CreateReferenceNode(referenceType, element);

                    if (node != null)
                    {
                        // Make sure that we do not want to add the item twice to the ui hierarchy
                        // We are using here the UI representation of the Node namely the Caption to find that out, in order to
                        // avoid different representation problems.
                        // Example :<Reference Include="EnvDTE80, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
                        //		  <Reference Include="EnvDTE80" />
                        bool found = false;
                        for (HierarchyNode n = this.FirstChild; n != null && !found; n = n.NextSibling)
                        {
                            if (String.Compare(n.Caption, node.Caption, StringComparison.OrdinalIgnoreCase) == 0)
                            {
                                found = true;
                            }
                        }

                        if (!found)
                        {
                            this.AddChild(node);
                        }
                    }
                }
            }
        }
Beispiel #11
0
 // =========================================================================================
 // Constructors
 // =========================================================================================
 /// <summary>
 /// Initializes a new instance of the <see cref="WixExtensionReferenceNode"/> class.
 /// </summary>
 /// <param name="root">The root <see cref="WixProjectNode"/> that contains this node.</param>
 /// <param name="element">The element that contains MSBuild properties.</param>
 public WixExtensionReferenceNode(WixProjectNode root, ProjectElement element)
     : base(root, element)
 {
     this.InitializeFileChangeEvents();
 }
Beispiel #12
0
 /// <summary>
 /// constructor for the ReferenceNode
 /// </summary>
 protected ReferenceNode(ProjectNode root, ProjectElement element)
     : base(root, element)
 {
     this.ExcludeNodeFromScc = true;
 }
 /// <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, ProjectElement e)
     : base(root, e)
 {
     this.HasParentNodeNameRelation = false;
 }
 /// <summary>
 /// Creates a com reference node from the project element.
 /// </summary>
 protected virtual ComReferenceNode CreateComReferenceNode(ProjectElement reference)
 {
     return(new ComReferenceNode(this.ProjectMgr, reference));
 }
 /// <summary>
 /// Creates a project reference node given an existing project element.
 /// </summary>
 protected virtual ProjectReferenceNode CreateProjectReferenceNode(ProjectElement element)
 {
     return(new ProjectReferenceNode(this.ProjectMgr, element));
 }
Beispiel #16
0
 public NestedProjectNode(ProjectNode root, ProjectElement element)
     : base(root, element)
 {
     this.IsExpanded = true;
 }
Beispiel #17
0
 /// <summary>
 /// constructor for the ReferenceNode
 /// </summary>
 protected TEntryPointFileNode(ProjectNode root, ProjectElement e) : base(root, e)
 {
     this.ExcludeNodeFromScc = true;
 }
 public NestedProjectNode(ProjectNode root, ProjectElement element)
     : base(root, element)
 {
     this.IsExpanded = true;
 }
Beispiel #19
0
 /// <summary>
 /// constructor for the ReferenceNode
 /// </summary>
 protected ReferenceNode(ProjectNode root, ProjectElement e)
     : base(root,e)
 {
     this.ExcludeNodeFromScc = true;
 }
        /// <summary>
        /// This can be called directly or through RunVsTemplateWizard.
        /// This will clone a template project file and add it as a
        /// subproject to our hierarchy.
        /// If you want to create a project for which there exist a
        /// vstemplate, consider using RunVsTemplateWizard instead.
        /// </summary>
        protected internal virtual NestedProjectNode AddNestedProjectFromTemplate(string fileName, string destination, string projectName, ProjectElement element, __VSCREATEPROJFLAGS creationFlags)
        {
            // If this is project creation and the template specified a subproject in its project file, this.nestedProjectElement will be used
            ProjectElement elementToUse = (element == null) ? this.nestedProjectElement : element;

            if (elementToUse == null)
            {
                // If this is null, this means MSBuild does not know anything about our subproject so add an MSBuild item for it
                elementToUse = new ProjectElement(this, fileName, ProjectFileConstants.SubProject);
            }

            NestedProjectNode node = CreateNestedProjectNode(elementToUse);

            node.Init(fileName, destination, projectName, creationFlags);

            // In case that with did not have an existing element, or the nestedProjectelement was null
            //  and since Init computes the final path, set the MSBuild item to that path
            if (this.nestedProjectElement == null)
            {
                string relativePath = node.Url;
                if (Path.IsPathRooted(relativePath))
                {
                    relativePath = this.ProjectFolder;
                    if (!relativePath.EndsWith("/\\"))
                    {
                        relativePath += Path.DirectorySeparatorChar;
                    }

                    relativePath = new Url(relativePath).MakeRelative(new Url(node.Url));
                }

                elementToUse.Rename(relativePath);
            }

            this.AddChild(node);
            return(node);
        }
Beispiel #21
0
 // JRock: Added
 /// <summary>
 /// Creates a project-specific reference node that isn't an assembly reference, COM reference, or project reference.
 /// </summary>
 protected virtual ReferenceNode CreateOtherReferenceNode(ProjectElement reference)
 {
     return(null);
 }
 /// <summary>
 /// Override this method if you want to provide your own type of nodes.
 /// This would be the case if you derive a class from NestedProjectNode
 /// </summary>
 protected virtual NestedProjectNode CreateNestedProjectNode(ProjectElement element)
 {
     return(new NestedProjectNode(this, element));
 }
        // =========================================================================================
        // Constructors
        // =========================================================================================

        /// <summary>
        /// Initializes a new instance of the <see cref="WixFolderNode"/> class.
        /// </summary>
        /// <param name="root">The root <see cref="WixProjectNode"/> that contains this node.</param>
        /// <param name="directoryPath">Root of the hierarchy.</param>
        /// <param name="element">The element that contains MSBuild properties.</param>
        public WixFolderNode(WixProjectNode root, string directoryPath, ProjectElement element)
            : this(root, directoryPath, element, false)
        {
        }
        /// <summary>
        /// Reloads a nested project node by deleting it and readding it.
        /// </summary>
        /// <param name="node">The node to reload.</param>
        protected virtual void ReloadNestedProjectNode(NestedProjectNode node)
        {
            if (node == null)
            {
                throw new ArgumentNullException("node");
            }

            IVsSolution solution = this.GetService(typeof(IVsSolution)) as IVsSolution;

            if (solution == null)
            {
                throw new InvalidOperationException();
            }

            NestedProjectNode newNode = null;

            try
            {
                // (VS 2005 UPDATE) When deleting and re-adding the nested project,
                // we do not want SCC to see this as a delete and add operation.
                this.EventTriggeringFlag = ProjectNode.EventTriggering.DoNotTriggerTrackerEvents;

                // notify SolutionEvents listeners that we are about to add children
                IVsFireSolutionEvents fireSolutionEvents = solution as IVsFireSolutionEvents;

                if (fireSolutionEvents == null)
                {
                    throw new InvalidOperationException();
                }

                ErrorHandler.ThrowOnFailure(fireSolutionEvents.FireOnBeforeUnloadProject(node.NestedHierarchy));

                int isDirtyAsInt = 0;
                this.IsDirty(out isDirtyAsInt);

                bool isDirty = (isDirtyAsInt == 0) ? false : true;

                ProjectElement element = node.ItemNode;
                node.CloseNestedProjectNode();

                // Remove from the solution
                this.RemoveChild(node);

                // Now readd it
                try
                {
                    __VSCREATEPROJFLAGS flags = __VSCREATEPROJFLAGS.CPF_NOTINSLNEXPLR | __VSCREATEPROJFLAGS.CPF_SILENT | __VSCREATEPROJFLAGS.CPF_OPENFILE;
                    newNode = this.AddExistingNestedProject(element, flags);
                    newNode.AddVirtualProject();
                }
                catch (Exception e)
                {
                    // We get a System.Exception if anything failed, thus we have no choice but catch it.
                    // Exceptions are digested by VS. Show the error if not in automation.
                    if (!Utilities.IsInAutomationFunction(this.Site))
                    {
                        string          message       = (String.IsNullOrEmpty(e.Message)) ? SR.GetString(SR.NestedProjectFailedToReload) : e.Message;
                        string          title         = string.Empty;
                        OLEMSGICON      icon          = OLEMSGICON.OLEMSGICON_CRITICAL;
                        OLEMSGBUTTON    buttons       = OLEMSGBUTTON.OLEMSGBUTTON_OK;
                        OLEMSGDEFBUTTON defaultButton = OLEMSGDEFBUTTON.OLEMSGDEFBUTTON_FIRST;
                        VsShellUtilities.ShowMessageBox(this.Site, title, message, icon, buttons, defaultButton);
                    }

                    // Do not digest exception. let the caller handle it. If in a later stage this exception is not digested then the above messagebox is not needed.
                    throw e;
                }

#if DEBUG
                IVsHierarchy nestedHierarchy;
                solution.GetProjectOfUniqueName(newNode.GetMkDocument(), out nestedHierarchy);
                Debug.Assert(nestedHierarchy != null && Utilities.IsSameComObject(nestedHierarchy, newNode.NestedHierarchy), "The nested hierrachy was not reloaded correctly.");
#endif
                this.SetProjectFileDirty(isDirty);

                fireSolutionEvents.FireOnAfterLoadProject(newNode.NestedHierarchy);
            }
            finally
            {
                // In this scenario the nested project failed to unload or reload the nested project. We will unload the whole project, otherwise the nested project is lost.
                // This is similar to the scenario when one wants to open a project and the nested project cannot be loaded because for example the project file has xml errors.
                // We should note that we rely here that if the unload fails then exceptions are not digested and are shown to the user.
                if (newNode == null || newNode.NestedHierarchy == null)
                {
                    solution.CloseSolutionElement((uint)__VSSLNCLOSEOPTIONS.SLNCLOSEOPT_UnloadProject | (uint)__VSSLNSAVEOPTIONS.SLNSAVEOPT_ForceSave, this, 0);
                }
                else
                {
                    this.EventTriggeringFlag = ProjectNode.EventTriggering.TriggerAll;
                }
            }
        }
Beispiel #25
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, ProjectElement e)
     : base(root, e)
 {
     if (this.ProjectMgr.NodeHasDesigner(this.ItemNode.GetMetadata(ProjectFileConstants.Include)))
     {
         this.HasDesigner = true;
     }
 }
Beispiel #26
0
        private static void AddNonMemberFolderItems(WixProjectNode project, IList<string> folderList)
        {
            if (folderList == null)
            {
                throw new ArgumentNullException("folderList");
            }

            foreach (string folderKey in folderList)
            {
                HierarchyNode parentNode = project;
                string[] folders = folderKey.Split(Path.DirectorySeparatorChar, Path.AltDirectorySeparatorChar);
                WixFolderNode topFolderNode = null;
                foreach (string folder in folders)
                {
                    string childNodeId = Path.Combine(parentNode.VirtualNodeName, folder);
                    FileInfo folderInfo = new FileInfo(Path.Combine(project.ProjectFolder, childNodeId));
                    if ((folderInfo.Attributes & FileAttributes.Hidden) == FileAttributes.Hidden)
                    {
                        break;
                    }

                    HierarchyNode childNode = parentNode.FindChild(childNodeId);
                    if (childNode == null)
                    {
                        if (topFolderNode == null)
                        {
                            topFolderNode = parentNode as WixFolderNode;
                            if (topFolderNode != null && (!topFolderNode.IsNonMemberItem) && topFolderNode.IsExpanded)
                            {
                                topFolderNode = null;
                            }
                        }

                        ProjectElement element = new ProjectElement(project, null, true);
                        childNode = project.CreateFolderNode(childNodeId, element);
                        parentNode.AddChild(childNode);
                    }

                    parentNode = childNode;
                }

                if (topFolderNode != null)
                {
                    topFolderNode.CollapseFolder();
                }
            }
        }
Beispiel #27
0
        /// <summary>
        /// Adds references to this container from a MSBuild project.
        /// </summary>
        public void LoadReferencesFromBuildProject(MSBuild.Project buildProject)
        {
            BuildResult buildResult = this.ProjectMgr.Build(MsBuildTarget.ResolveAssemblyReferences);
            foreach (string referenceType in SupportedReferenceTypes)
            {
                bool isAssemblyReference = referenceType == ProjectFileConstants.Reference;
                if (isAssemblyReference && !buildResult.IsSuccessful)
                {
                    continue;
                }

                foreach (var item in MSBuildProject.GetItems(buildProject, referenceType))
                {
                    ProjectElement element = new ProjectElement(this.ProjectMgr, item, false);

                    ReferenceNode node = CreateReferenceNode(referenceType, element);

                    if (node != null)
                    {
                        // Make sure that we do not want to add the item twice to the ui hierarchy
                        // We are using here the UI representation of the Node namely the Caption to find that out, in order to
                        // avoid different representation problems.
                        // Example :<Reference Include="EnvDTE80, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
                        //		  <Reference Include="EnvDTE80" />
                        bool found = false;
                        for (HierarchyNode n = this.FirstChild; n != null && !found; n = n.NextSibling)
                        {
                            if (String.Compare(n.Caption, node.Caption, StringComparison.OrdinalIgnoreCase) == 0)
                            {
                                found = true;
                            }
                        }

                        if (!found)
                        {
                            this.AddChild(node);
                        }
                    }
                }
            }
        }
Beispiel #28
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)
 {
     this.VirtualNodeName = relativePath.TrimEnd('\\');
 }
Beispiel #29
0
        private static void AddNonMemberFileItems(WixProjectNode project, IList<string> fileList)
        {
            if (fileList == null)
            {
                throw new ArgumentNullException("fileList");
            }

            foreach (string fileKey in fileList)
            {
                HierarchyNode parentNode = project;
                string[] pathItems = fileKey.Split(new char[] { Path.DirectorySeparatorChar, Path.AltDirectorySeparatorChar });

                if (String.Equals(fileKey, project.ProjectFile, StringComparison.OrdinalIgnoreCase))
                {
                    continue;
                }

                WixFolderNode topFolderNode = null;
                foreach (string fileOrDir in pathItems)
                {
                    string childNodeId = Path.Combine(parentNode.VirtualNodeName, fileOrDir);
                    FileInfo fileOrDirInfo = new FileInfo(Path.Combine(project.ProjectFolder, childNodeId));
                    if ((fileOrDirInfo.Attributes & FileAttributes.Hidden) == FileAttributes.Hidden)
                    {
                        break;
                    }

                    HierarchyNode childNode = parentNode.FindChild(childNodeId);
                    if (childNode == null)
                    {
                        if (topFolderNode == null)
                        {
                            topFolderNode = parentNode as WixFolderNode;
                            if (topFolderNode != null && (!topFolderNode.IsNonMemberItem) && topFolderNode.IsExpanded)
                            {
                                topFolderNode = null;
                            }
                        }

                        ProjectElement element = new ProjectElement(project, null, true);
                        element.Rename(childNodeId);
                        element.SetMetadata(ProjectFileConstants.Name, childNodeId);
                        childNode = project.CreateFileNode(element);
                        parentNode.AddChild(childNode);
                        break;
                    }

                    parentNode = childNode;
                }

                if (topFolderNode != null)
                {
                    topFolderNode.CollapseFolder();
                }
            }
        }
Beispiel #30
0
        /// <summary>
        /// Get information from the registry based for the project 
        /// factory corresponding to the TypeGuid of the element
        /// </summary>
        private RegisteredProjectType GetRegisteredProject(ProjectElement element)
        {
            ProjectElement elementToUse = (element == null) ? this.nestedProjectElement : element;

            if (elementToUse == null)
            {
                throw new ArgumentNullException("element");
            }

            // Get the project type guid from project elementToUse
            string typeGuidString = elementToUse.GetMetadataAndThrow(ProjectFileConstants.TypeGuid, new ApplicationException());
            Guid projectFactoryGuid = new Guid(typeGuidString);

            EnvDTE.DTE dte = this.ProjectMgr.Site.GetService(typeof(EnvDTE.DTE)) as EnvDTE.DTE;
            Debug.Assert(dte != null, "Could not get the automation object from the services exposed by this project");

            if (dte == null)
                throw new InvalidOperationException();

            RegisteredProjectType registeredProjectType = RegisteredProjectType.CreateRegisteredProjectType(dte, projectFactoryGuid);
            Debug.Assert(registeredProjectType != null, "Could not read the registry setting associated to this project.");
            if (registeredProjectType == null)
            {
                throw new InvalidOperationException();
            }
            return registeredProjectType;
        }
Beispiel #31
0
        /// <summary>
        /// Creates an assembly refernce node from a project element.
        /// </summary>
        protected virtual AssemblyReferenceNode CreateAssemblyReferenceNode(ProjectElement element)
        {
            AssemblyReferenceNode node = null;
            try
            {
                node = new AssemblyReferenceNode(this.ProjectMgr, element);
            }
            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;
        }
Beispiel #32
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)
		{
			this.VirtualNodeName = relativePath.TrimEnd('\\');
		}
Beispiel #33
0
 /// <summary>
 /// Creates a project reference node given an existing project element.
 /// </summary>
 protected virtual ProjectReferenceNode CreateProjectReferenceNode(ProjectElement element)
 {
     return new ProjectReferenceNode(this.ProjectMgr, element);
 }
Beispiel #34
0
        // =========================================================================================
        // Constructors
        // =========================================================================================

        /// <summary>
        /// Initializes a new instance of the <see cref="WixFileNode"/> class.
        /// </summary>
        /// <param name="root">The root <see cref="WixProjectNode"/> that contains this node.</param>
        /// <param name="element">The element that contains MSBuild properties.</param>
        public WixFileNode(WixProjectNode root, ProjectElement element)
            : this(root, element, false)
        {
        }
        // =========================================================================================
        // Constructors
        // =========================================================================================

        /// <summary>
        /// Initializes a new instance of the <see cref="WixProjectReferenceNode"/> class.
        /// </summary>
        /// <param name="root">The root <see cref="WixProjectNode"/> that contains this node.</param>
        /// <param name="element">The element that contains MSBuild properties.</param>
        public WixProjectReferenceNode(WixProjectNode root, ProjectElement element)
            : base(root, element)
        {
        }
Beispiel #36
0
 public WixFileNode(WixProjectNode root, ProjectElement element, bool isNonMemberItem)
     : base(root, element)
 {
     this.isNonMemberItem = isNonMemberItem;
 }
 public RubyFileNode(ProjectNode root, ProjectElement e)
     : base(root, e)
 {
 }
Beispiel #38
0
 /// <summary>
 /// Creates a project reference node given an existing project element.
 /// </summary>
 /// <param name="element">MSBuild properties for the project.</param>
 /// <returns>A <see cref="WixProjectReferenceNode"/> instance.</returns>
 protected override ProjectReferenceNode CreateProjectReferenceNode(ProjectElement element)
 {
     return new WixProjectReferenceNode(this.ProjectMgr as WixProjectNode, element);
 }
        private ProjectElement GetProjectElementBasedOnInputFromComponentSelectorData()
        {
            ProjectElement element = new ProjectElement(this.ProjectMgr, this.typeName, ProjectFileConstants.COMReference);

            // Set the basic information regarding this COM component
            element.SetMetadata(ProjectFileConstants.Guid, this.typeGuid.ToString("B"));
            element.SetMetadata(ProjectFileConstants.VersionMajor, this.majorVersionNumber);
            element.SetMetadata(ProjectFileConstants.VersionMinor, this.minorVersionNumber);
            element.SetMetadata(ProjectFileConstants.Lcid, this.lcid);
            element.SetMetadata(ProjectFileConstants.Isolated, false.ToString());

            // See if a PIA exist for this component
            TypeLibConverter typelib = new TypeLibConverter();
            string assemblyName;
            string assemblyCodeBase;
            if (typelib.GetPrimaryInteropAssembly(this.typeGuid, Int32.Parse(this.majorVersionNumber, CultureInfo.InvariantCulture), Int32.Parse(this.minorVersionNumber, CultureInfo.InvariantCulture), Int32.Parse(this.lcid, CultureInfo.InvariantCulture), out assemblyName, out assemblyCodeBase))
            {
                element.SetMetadata(ProjectFileConstants.WrapperTool, WrapperToolAttributeValue.Primary.ToString().ToLowerInvariant());
            }
            else
            {
                // MSBuild will have to generate an interop assembly
                element.SetMetadata(ProjectFileConstants.WrapperTool, WrapperToolAttributeValue.TlbImp.ToString().ToLowerInvariant());
                element.SetMetadata(ProjectFileConstants.Private, true.ToString());
            }
            return element;
        }
Beispiel #40
0
        /// <summary>
        /// Creates a new <see cref="WixLibraryReferenceNode"/> if the element is a "WixLibraryReference",
        /// a new <see cref="WixExtensionReferenceNode"/> if the element is a "WixExtensionReference",
        /// or a new <see cref="WixProjectReferenceNode"/> if the element is a "ProjectReference".
        /// </summary>
        /// <param name="referenceType">The type of reference to be created.</param>
        /// <param name="element">The MSBuild element pertaining to the reference.</param>
        /// <returns>A <see cref="WixLibraryReferenceNode"/>, <see cref="WixExtensionReferenceNode"/>,
        /// or a <see cref="WixProjectReferenceNode"/>.</returns>
        protected override ReferenceNode CreateReferenceNode(string referenceType, ProjectElement element)
        {
            switch (element.ItemName)
            {
                case WixProjectFileConstants.WixLibrary:
                    return new WixLibraryReferenceNode(this.ProjectMgr as WixProjectNode, element);

                case WixProjectFileConstants.WixExtension:
                    return new WixExtensionReferenceNode(this.ProjectMgr as WixProjectNode, element);
            }

            return base.CreateReferenceNode(referenceType, element);
        }
 internal MultiverseInterfacePythonFileNode(ProjectNode root, ProjectElement e)
     : base(root, e)
 {
 }
Beispiel #42
0
 /// <summary>
 /// Constructor for the FolderNode
 /// </summary>
 /// <param name="root">Root of the hierarchy</param>
 /// <param name="strDirectoryPath">Root of the hierarchy</param>
 /// <param name="e">Associated project element</param>
 public FolderNode(ProjectNode root, string strDirectoryPath, ProjectElement e)
     : base(root, e)
 {
     this.VirtualNodeName = strDirectoryPath.TrimEnd('\\');             //complete path from root project i.e.: "NewFolder1\\NewFolder2\\NewFolder3
 }