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


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

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


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

示例1: MakeTemplateReplacements

        static internal void MakeTemplateReplacements(bool isAProject, bool creatingProject,
            string rootNamespace, string sourceFileName, _BE.Project proj)
        {
            if (isAProject)
            {
                if (!string.IsNullOrEmpty(rootNamespace))
                {
                    _BE.ProjectProperty prop;
                    string name;

                    name = "StartupObject";
                    prop = proj.GetProperty(name);
                    if (prop != null) proj.SetProperty(name, prop.UnevaluatedValue.Replace(rootNamespace + ".", "$safeprojectname$."));

                    name = "DocumentationFile";
                    prop = proj.GetProperty(name);
                    if (prop != null) proj.SetProperty(name, prop.UnevaluatedValue.Replace(rootNamespace + ".", "$safeprojectname$."));

                    name = "RootNamespace";
                    prop = proj.GetProperty(name);
                    if (prop != null) proj.SetProperty(name, prop.UnevaluatedValue.Replace(rootNamespace, "$safeprojectname$"));

                    name = "AssemblyName";
                    prop = proj.GetProperty(name);
                    if (prop != null) proj.SetProperty(name, prop.UnevaluatedValue.Replace(rootNamespace, "$safeprojectname$"));
                }
            }
            else
            {
                if (creatingProject == true)
                {
                    //Exporting the entire project ... replace projectname only; this may not work as desired for Web projects,
                    //we don't have any so we don't care.
                    WordReplace(proj, rootNamespace, "$safeprojectname$");
                }
                else
                {
                    //Exporting a single item from a project. Replace root name space (if given)
                    //and item name
                    if (!string.IsNullOrEmpty(rootNamespace))
                    {
                        WordReplace(proj, rootNamespace, "$rootnamespace$");
                    }

                    string itemName = Path.GetFileNameWithoutExtension(sourceFileName);
                    int iDotIndex = itemName.LastIndexOf(".");
                    if (iDotIndex != -1)
                    {
                        //This is intended to fix the foo.designer.vb case (GetFileNameWithoutExtension()
                        //returns foo.designer, and we want to replace just foo
                        itemName = itemName.Substring(0, iDotIndex);
                    }

                    WordReplace(proj, itemName, "$safeitemname$");
                }
            }
        }
开发者ID:aura1213,项目名称:netmf-interpreter,代码行数:57,代码来源:TransmorgificationUtilities.cs


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