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


C# Microsoft.Build.Evaluation.GetMetadataValue方法代码示例

本文整理汇总了C#中Microsoft.Build.Evaluation.GetMetadataValue方法的典型用法代码示例。如果您正苦于以下问题:C# Microsoft.Build.Evaluation.GetMetadataValue方法的具体用法?C# Microsoft.Build.Evaluation.GetMetadataValue怎么用?C# Microsoft.Build.Evaluation.GetMetadataValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Microsoft.Build.Evaluation的用法示例。


在下文中一共展示了Microsoft.Build.Evaluation.GetMetadataValue方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GetMetadataValue

 public static string GetMetadataValue(MSBuild.ProjectItem item, string name)
 {
     return item.GetMetadataValue(name);
 }
开发者ID:zooba,项目名称:wix3,代码行数:4,代码来源:projectelement.cs

示例2: GetItemParentNode

        /// <summary>
        /// Get the parent node of an msbuild item
        /// </summary>
        /// <param name="item">msbuild item</param>
        /// <returns>parent node</returns>
        protected virtual HierarchyNode GetItemParentNode(MSBuild.ProjectItem item, IDictionary<string, HierarchyNode> nodeCache)
        {
            if (item == null)
                throw new ArgumentNullException("item");
            if (nodeCache == null)
                throw new ArgumentNullException("nodeCache");
            //Contract.Ensures(Contract.Result<HierarchyNode>() != null);

            HierarchyNode currentParent = this;
            string strPath = item.EvaluatedInclude;
            string link = item.GetMetadataValue(ProjectFileConstants.Link);
            if (!string.IsNullOrEmpty(link))
                strPath = link;

            strPath = Path.GetDirectoryName(strPath);
            if (strPath.Length > 0)
            {
                if (!nodeCache.TryGetValue(strPath, out currentParent))
                {
                    // Use the relative to verify the folders...
                    currentParent = this.CreateFolderNodes(strPath, nodeCache);
                    nodeCache.Add(strPath, currentParent);
                }
            }

            return currentParent;
        }
开发者ID:sharwell,项目名称:MPFProj10,代码行数:32,代码来源:ProjectNode.cs

示例3: GetItemParentNode

 /// <summary>
 /// Get the parent node of an msbuild item
 /// </summary>
 /// <param name="item">msbuild item</param>
 /// <returns>parent node</returns>
 private HierarchyNode GetItemParentNode(MSBuild.ProjectItem item)
 {
     var isLink = IsLinkNode(item);
     var path = isLink ? item.GetMetadataValue("Link") : item.EvaluatedInclude;
     var dir = Path.GetDirectoryName(path);
     return Path.IsPathRooted(dir) || string.IsNullOrEmpty(dir)
         ? this : CreateFolderNodes(dir);
 }
开发者ID:vestild,项目名称:nemerle,代码行数:13,代码来源:NemerleProjectNode.cs

示例4: AddIndependentFileNode

        /// <summary>
        /// Add an item to the hierarchy based on the item path
        /// </summary>
        /// <param name="item">Item to add</param>
        /// <returns>Added node</returns>
        protected virtual HierarchyNode AddIndependentFileNode(MSBuild.ProjectItem item, IDictionary<string, HierarchyNode> parentNodeCache)
        {
            if (item == null)
                throw new ArgumentNullException("item");
            if (parentNodeCache == null)
                throw new ArgumentNullException("parentNodeCache");
            //Contract.Ensures(Contract.Result<HierarchyNode>() != null);

            // Make sure the item is within the project folder hierarchy. If not, link it.
            string linkPath = item.GetMetadataValue(ProjectFileConstants.Link);
            if (String.IsNullOrEmpty(linkPath))
            {
                string projectFolder = new Uri(this.ProjectFolder).LocalPath;
                string itemPath = new Uri(Path.Combine(this.ProjectFolder, item.EvaluatedInclude)).LocalPath;
                if (!itemPath.StartsWith(projectFolder, StringComparison.OrdinalIgnoreCase))
                {
                    linkPath = Path.GetFileName(item.EvaluatedInclude);
                    item.SetMetadataValue(ProjectFileConstants.Link, linkPath);
                }
            }

            HierarchyNode currentParent = GetItemParentNode(item, parentNodeCache);
            return AddFileNodeToNode(item, currentParent);
        }
开发者ID:sharwell,项目名称:MPFProj10,代码行数:29,代码来源:ProjectNode.cs

示例5: GetItemParentNode

        /// <summary>
        /// Get the parent node of an msbuild item
        /// </summary>
        /// <param name="item">msbuild item</param>
        /// <returns>parent node</returns>
        private HierarchyNode GetItemParentNode(MSBuild.ProjectItem item)
        {
            HierarchyNode currentParent = this;
            string strPath;

            // !EFW
            // If it's a link, use the linked path for the node
            strPath = item.GetMetadataValue(ProjectFileConstants.Link);

            if(String.IsNullOrEmpty(strPath))
                strPath = item.EvaluatedInclude;

            strPath = Path.GetDirectoryName(strPath);
            if(strPath.Length > 0)
            {
                // Use the relative to verify the folders...
                currentParent = this.CreateFolderNodes(strPath);
            }
            return currentParent;
        }
开发者ID:julianhaslinger,项目名称:SHFB,代码行数:25,代码来源:ProjectNode.cs


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