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


C# Microsoft.GetMetadataValue方法代码示例

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


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

示例1: SpecialCharactersInMetadataValueTests

        /// <summary>
        /// Helper for metadata escaping tests
        /// </summary>
        private void SpecialCharactersInMetadataValueTests(Microsoft.Build.Evaluation.ProjectItem item)
        {
            Assert.AreEqual("%3B", item.GetMetadata("EscapedSemicolon").UnevaluatedValue);
            Assert.AreEqual(";", item.GetMetadata("EscapedSemicolon").EvaluatedValue);
            Assert.AreEqual(";", item.GetMetadataValue("EscapedSemicolon"));

            Assert.AreEqual("%24", item.GetMetadata("EscapedDollarSign").UnevaluatedValue);
            Assert.AreEqual("$", item.GetMetadata("EscapedDollarSign").EvaluatedValue);
            Assert.AreEqual("$", item.GetMetadataValue("EscapedDollarSign"));
        }
开发者ID:ravpacheco,项目名称:msbuild,代码行数:13,代码来源:ProjectMetadata_Tests.cs

示例2: GetPublishSetting

 private static bool? GetPublishSetting(Microsoft.Build.Execution.ProjectItemInstance item)
 {
     bool? publish = null;
     string pubValue = item.GetMetadataValue("Publish");
     bool pubSetting;
     if (!String.IsNullOrWhiteSpace(pubValue) && Boolean.TryParse(pubValue, out pubSetting)) {
         publish = pubSetting;
     }
     return publish;
 }
开发者ID:borota,项目名称:JTVS,代码行数:10,代码来源:PublishProject.cs

示例3: GetAssemblyFileNameFromHintPath

 string GetAssemblyFileNameFromHintPath(Microsoft.Build.Evaluation.Project p, Microsoft.Build.Evaluation.ProjectItem item)
 {
     string assemblyFileName = null;
     if (item.HasMetadata("HintPath"))
     {
         assemblyFileName = _fileSystem.Path.Combine(p.DirectoryPath, item.GetMetadataValue("HintPath")).ForceNativePathSeparator();
         _logger.Info("Looking for assembly from HintPath at " + assemblyFileName);
         if (!_fileSystem.File.Exists(assemblyFileName))
         {
             _logger.Info("Did not find assembly from HintPath");
             assemblyFileName = null;
         }
     }
     return assemblyFileName;
 }
开发者ID:gtarcoder,项目名称:vim_config1,代码行数:15,代码来源:CSharpProject.cs

示例4: GetItemParentNode

        /// <summary>
        /// Get the parent node of an msbuild item
        /// </summary>
        /// <param name="item">msbuild item</param>
        /// <returns>parent node</returns>
        private HierarchyNode GetItemParentNode(Microsoft.Build.Evaluation.ProjectItem item)
        {
            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)
            {
                // Use the relative to verify the folders...
                currentParent = this.CreateFolderNodes(strPath);
            }
            return currentParent;
        }
开发者ID:bullshock29,项目名称:Wix3.6Toolset,代码行数:23,代码来源:projectnode.cs

示例5: 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>
        private HierarchyNode AddIndependentFileNode(Microsoft.Build.Evaluation.ProjectItem item)
        {
            bool shouldLink = false;
            // Remove any redundant "." directories from the Include path.
            string includePath = item.Xml.Include.Replace("/./", "/").Replace("\\.\\", "\\");
            while (includePath.StartsWith("./", StringComparison.Ordinal) || includePath.StartsWith(".\\", StringComparison.Ordinal))
            {
                includePath = includePath.Substring(2);
            }

            // Don't set the property unless necessary to avoid dirtying the project.
            if (includePath != item.Xml.Include)
            {
                item.Xml.Include = includePath;
            }

            // 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.Xml.Include)).LocalPath;
                if (!itemPath.StartsWith(projectFolder, StringComparison.OrdinalIgnoreCase))
                {
                    shouldLink = true;
                }
            }

            HierarchyNode currentParent;
            // If the file is outside of the project dir, link to it and place
            // it under the project node. Do not attempt to create a '..'
            // folder node.
            if (shouldLink)
            {
                currentParent = this;
            }
            else
            {
                currentParent = GetItemParentNode(item);
            }

            HierarchyNode newNode = AddFileNodeToNode(item, currentParent);

            if (shouldLink)
            {
                linkPath = Path.GetFileName(item.Xml.Include);
                newNode.ItemNode.SetMetadata(ProjectFileConstants.Link, linkPath);
            }

            return newNode;
        }
开发者ID:bullshock29,项目名称:Wix3.6Toolset,代码行数:56,代码来源:projectnode.cs

示例6: GetMetadataValue

 public static string GetMetadataValue(Microsoft.Build.Execution.ProjectItemInstance item, string name)
 {
     return item.GetMetadataValue(name);
 }
开发者ID:xenocons,项目名称:visualfsharp,代码行数:4,代码来源:ProjectElement.cs


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