当前位置: 首页>>代码示例>>C#>>正文


C# Package.ProjectElement类代码示例

本文整理汇总了C#中Microsoft.VisualStudio.Package.ProjectElement的典型用法代码示例。如果您正苦于以下问题:C# ProjectElement类的具体用法?C# ProjectElement怎么用?C# ProjectElement使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


ProjectElement类属于Microsoft.VisualStudio.Package命名空间,在下文中一共展示了ProjectElement类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: HierarchyItemNode

        /// <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);
        }
开发者ID:hesam,项目名称:SketchSharp,代码行数:14,代码来源:HierarchyItem.cs

示例2: WixReferenceNode

        // =========================================================================================
        // 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
                {
                }
            }
        }
开发者ID:Jeremiahf,项目名称:wix3,代码行数:39,代码来源:WixReferenceNode.cs

示例3: ProjectReferenceNode

        /// <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);
            }
        }
开发者ID:zooba,项目名称:wix3,代码行数:35,代码来源:ProjectReferenceNode.cs

示例4: WixFolderNode

        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;
        }
开发者ID:bullshock29,项目名称:Wix3.6Toolset,代码行数:8,代码来源:WixFolderNode.cs

示例5: AssemblyReferenceNode

        /// <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));
        }
开发者ID:Xtremrules,项目名称:dot42,代码行数:12,代码来源:AssemblyReferenceNode.cs

示例6: Output

        /// <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;
        }
开发者ID:Jeremiahf,项目名称:wix3,代码行数:19,代码来源:output.cs

示例7: ComReferenceNode

        /// <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();
        }
开发者ID:einaregilsson,项目名称:Process-Language-Runtime,代码行数:19,代码来源:ComReferenceNode.cs

示例8: CreateProjectReferenceNode

 /// <summary>
 /// Creates a project reference node given an existing project element.
 /// </summary>
 protected virtual ProjectReferenceNode CreateProjectReferenceNode(ProjectElement element)
 {
     return new ProjectReferenceNode(this.ProjectMgr, element);
 }
开发者ID:zooba,项目名称:wix3,代码行数:7,代码来源:referencecontainernode.cs

示例9: CreateComReferenceNode

 /// <summary>
 /// Creates a com reference node from the project element.
 /// </summary>
 protected virtual ComReferenceNode CreateComReferenceNode(ProjectElement reference)
 {
     return new ComReferenceNode(this.ProjectMgr, reference);
 }
开发者ID:zooba,项目名称:wix3,代码行数:7,代码来源:referencecontainernode.cs

示例10: CreateAssemblyReferenceNode

        /// <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;
        }
开发者ID:zooba,项目名称:wix3,代码行数:33,代码来源:referencecontainernode.cs

示例11: WixFileNode

 public WixFileNode(WixProjectNode root, ProjectElement element, bool isNonMemberItem)
     : base(root, element)
 {
     this.isNonMemberItem = isNonMemberItem;
 }
开发者ID:Jeremiahf,项目名称:wix3,代码行数:5,代码来源:WixFileNode.cs

示例12: NestedProjectNode

 public NestedProjectNode(ProjectNode root, ProjectElement element)
     : base(root, element)
 {
     this.IsExpanded = true;
 }
开发者ID:bullshock29,项目名称:Wix3.6Toolset,代码行数:5,代码来源:nestedprojectnode.cs

示例13: ReferenceNode

 /// <summary>
 /// constructor for the ReferenceNode
 /// </summary>
 protected ReferenceNode(ProjectNode root, ProjectElement e)
     : base(root,e)
 {
     this.ExcludeNodeFromScc = true;
 }
开发者ID:Xtremrules,项目名称:dot42,代码行数:8,代码来源:ReferenceNode.cs

示例14: FileNode

 /// <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;
     }
 }
开发者ID:Xtremrules,项目名称:dot42,代码行数:13,代码来源:FileNode.cs

示例15: LoadReferencesFromBuildProject

        /// <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);
                        }
                    }
                }
            }
        }
开发者ID:Jeremiahf,项目名称:wix3,代码行数:46,代码来源:referencecontainernode.cs


注:本文中的Microsoft.VisualStudio.Package.ProjectElement类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。