• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# Build.Evaluation类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: Children

 public static IEnumerable<MBEV.ResolvedImport> Children(this MBEV.ResolvedImport import, MBEV.Project project)
 {
     return project.Imports.Where(
         i => string.Equals(i.ImportingElement.ContainingProject.FullPath,
                            project.ResolveAllProperties(import.ImportedProject.Location.File),
                            StringComparison.OrdinalIgnoreCase));
 }
开发者ID:nayanshah,项目名称:MSBuildTracer,代码行数:7,代码来源:Extensions.cs


示例2: PreProcess

        public void PreProcess(MSBuild.Project project)
        {
            if (project.ProjectFileLocation.File.EndsWith(".user", System.StringComparison.OrdinalIgnoreCase)) {
                return;
            }

            project.SetProperty("ProjectTypeGuids", "{00251F00-BA30-4CE4-96A2-B8A1085F37AA};{3AF33F2E-1136-4D97-BBB7-1795711AC8B8};{9092AA53-FB77-4645-B42D-1CCCA6BD08BD}");
            project.SetProperty("VisualStudioVersion", "14.0");
            project.Xml.AddProperty("VisualStudioVersion", "14.0").Condition = "'$(VisualStudioVersion)' == ''";
            project.Xml.AddProperty("VSToolsPath", "$(MSBuildExtensionsPath32)\\Microsoft\\VisualStudio\\v$(VisualStudioVersion)").Condition = "'$(VSToolsPath)' == ''";
            project.Xml.AddImport("$(VSToolsPath)\\Node.js Tools\\Microsoft.NodejsUwp.targets");
            project.SetProperty("ProjectHome", ".");
            project.SetProperty("ProjectView", "ShowAllFiles");
            project.SetProperty("OutputPath", ".");
            project.SetProperty("AppContainerApplication", "true");
            project.SetProperty("ApplicationType", "Windows Store");
            project.SetProperty("OutpApplicationTypeRevisionutPath", "8.2");
            project.SetProperty("AppxPackage", "true");
            project.SetProperty("WindowsAppContainer", "true");
            project.SetProperty("RemoteDebugEnabled", "true");
            project.SetProperty("PlatformAware", "true");
            project.SetProperty("AvailablePlatforms", "x86,x64,ARM");

            // Add package.json
            string jsonStr = "{\"name\": \"HelloWorld\",\"version\": \"0.0.0\",\"main\": \"server.js\"}";
            string jsonPath = string.Format("{0}\\package.json", project.DirectoryPath);

            using (FileStream fs = File.Create(jsonPath)) {
                fs.Write(Encoding.ASCII.GetBytes(jsonStr), 0, jsonStr.Length);
            }
            ProjectItemGroupElement itemGroup = project.Xml.AddItemGroup();
            itemGroup.AddItem("Content", jsonPath);
        }
开发者ID:munyirik,项目名称:ntvsiot,代码行数:33,代码来源:NodejsUwpProjectProcessor.cs


示例3: MsBuildProjectElement

        /// <summary>
        /// Constructor to Wrap an existing MSBuild.ProjectItem
        /// Only have internal constructors as the only one who should be creating
        /// such object is the project itself (see Project.CreateFileNode()).
        /// </summary>
        /// <param name="project">Project that owns this item</param>
        /// <param name="existingItem">an MSBuild.ProjectItem; can be null if virtualFolder is true</param>
        /// <param name="virtualFolder">Is this item virtual (such as reference folder)</param>
        internal MsBuildProjectElement(ProjectNode project, MSBuild.ProjectItem existingItem)
            : base(project) {
            Utilities.ArgumentNotNull("existingItem", existingItem);

            // Keep a reference to project and item
            _item = existingItem;
        }
开发者ID:vairam-svs,项目名称:poshtools,代码行数:15,代码来源:MsBuildProjectElement.cs


示例4: PrintPropertyInfo

        private static void PrintPropertyInfo(MBEV.ProjectProperty property, int indentCount)
        {
            var indent = new string('\t', indentCount);
            string location;

            if (property.IsEnvironmentProperty)
            {
                location = "(environment)";
            }
            else if (property.IsReservedProperty)
            {
                location = "(reserved)";
            }
            else
            {
                location = $"{property.Xml.Location.File}:{property.Xml.Location.Line}";
            }

            Utils.WriteColor($"{indent}Loc:  ", ConsoleColor.White);
            Utils.WriteLineColor(location, ConsoleColor.DarkCyan);

            if (property.UnevaluatedValue == property.EvaluatedValue)
            {
                Utils.WriteColor($"{indent}Val:  ", ConsoleColor.White);
                Utils.WriteLineColor(property.EvaluatedValue, ConsoleColor.Green);
            }
            else
            {
                Utils.WriteColor($"{indent}Val:  ", ConsoleColor.White);
                Utils.WriteLineColor(property.UnevaluatedValue, ConsoleColor.DarkGreen);
                Utils.WriteColor($"{indent}      ", ConsoleColor.White);
                Utils.WriteLineColor(property.EvaluatedValue, ConsoleColor.Green);
            }
        }
开发者ID:nayanshah,项目名称:MSBuildTracer,代码行数:34,代码来源:PropertyTracer.cs


示例5: Execute

        /// <summary>
        /// Executes the task.
        /// </summary>
        /// <returns>True if the task executed successfully; otherwise, false.</returns>
        public bool Execute()
        {
            var fullPath = SourceProjectPath;
            var basePath = Path.GetDirectoryName( fullPath );
            var project = ProjectCollection.GlobalProjectCollection.LoadProject( fullPath );

            try
            {
                var assemblyInfos = from item in project.GetItems( "Compile" )
                                    let include = item.EvaluatedInclude
                                    where include.EndsWith( "AssemblyInfo.cs", StringComparison.OrdinalIgnoreCase )
                                    let itemPath = Path.GetFullPath( Path.Combine( basePath, include ) )
                                    let code = File.ReadAllText( itemPath )
                                    select CSharpSyntaxTree.ParseText( code );
                var references = new[] { MetadataReference.CreateFromFile( typeof( object ).Assembly.Location ) };
                var compilation = CSharpCompilation.Create( project.GetPropertyValue( "AssemblyName" ), assemblyInfos, references );
                var attributes = compilation.Assembly.GetAttributes().ToArray();

                IsValid = true;
                PopulateMetadataFromAttributes( attributes );
            }
            finally
            {
                ProjectCollection.GlobalProjectCollection.UnloadProject( project );
            }

            return IsValid;
        }
开发者ID:WaffleSquirrel,项目名称:More,代码行数:32,代码来源:AssemblyMetadataTask.cs


示例6: Generate

        public override void Generate(ProjectType projectType, MSBuild.Project project) {
            var filename = Path.Combine(project.DirectoryPath, Name);
            File.WriteAllText(filename, Content);

            if (!IsExcluded) {
                project.AddItem("Content", Name);
            }
        }
开发者ID:sramos30,项目名称:ntvsiot,代码行数:8,代码来源:ContentItem.cs


示例7: Trace

        public void Trace(MBEV.ResolvedImport import, int traceLevel = 0)
        {
            PrintImportInfo(import, traceLevel);

            foreach (var childImport in import.Children(project))
            {
                Trace(childImport, traceLevel + $"{import.ImportingElement.Location.Line}: ".Length);
            }
        }
开发者ID:nayanshah,项目名称:MSBuildTracer,代码行数:9,代码来源:ImportTracer.cs


示例8: Generate

 public override void Generate(ProjectType projectType, MSBuild.Project project) {
     var target = project.Xml.AddTarget(Name);
     if (!string.IsNullOrEmpty(DependsOnTargets)) {
         target.DependsOnTargets = DependsOnTargets;
     }
     foreach (var creator in Creators) {
         creator(target);
     }
 }
开发者ID:ReedCopsey,项目名称:VisualFSharpPowerTools,代码行数:9,代码来源:TargetDefinition.cs


示例9: Generate

        public override void Generate(ProjectType projectType, MSBuild.Project project) {
            if (!IsMissing) {
                Directory.CreateDirectory(Path.Combine(project.DirectoryPath, Name));
            }

            if (!IsExcluded) {
                project.AddItem("Folder", Name);
            }
        }
开发者ID:RussBaz,项目名称:PTVS,代码行数:9,代码来源:FolderItem.cs


示例10: Generate

        public override void Generate(ProjectType projectType, MSBuild.Project project) {
            if (!IsMissing) {
                var absName = Path.IsPathRooted(Name) ? Name : Path.Combine(project.DirectoryPath, Name);
                var absReferencePath = Path.IsPathRooted(ReferencePath) ? ReferencePath : Path.Combine(project.DirectoryPath, ReferencePath);
                
                NativeMethods.CreateSymbolicLink(absName, absReferencePath);
            }

            if (!IsExcluded) {
                project.AddItem("Folder", Name);
            }
        }
开发者ID:CforED,项目名称:Node.js-Tools-for-Visual-Studio,代码行数:12,代码来源:SymbolicLinkItem.cs


示例11: PreProcess

        public void PreProcess(MSBuild.Project project) {
            project.SetProperty("ProjectHome", ".");
            project.SetProperty("WorkingDirectory", ".");

            project.Xml.AddProperty("VisualStudioVersion", "11.0").Condition = "'$(VisualStudioVersion)' == ''";
            project.Xml.AddProperty("PtvsTargetsFile", "$(MSBuildExtensionsPath32)\\Microsoft\\VisualStudio\\v$(VisualStudioVersion)\\Python Tools\\Microsoft.PythonTools.targets");

            var import1 = project.Xml.AddImport("$(PtvsTargetsFile)");
            import1.Condition = "Exists($(PtvsTargetsFile))";
            var import2 = project.Xml.AddImport("$(MSBuildToolsPath)\\Microsoft.Common.targets");
            import2.Condition = "!Exists($(PtvsTargetsFile))";
        }
开发者ID:wenh123,项目名称:PTVS,代码行数:12,代码来源:PythonProjectProcessor.cs


示例12: UpdateProject

        public void UpdateProject(PythonProjectNode node, MSBuild.Project project) {
            lock (_projects) {
                if (project == null) {
                    _projects.Remove(node);
                } else if (!_projects.ContainsKey(node) || _projects[node] != project) {
                    _projects[node] = project;
                }
            }

            // Always raise the event, this also occurs when we're adding projects
            // to the MSBuild.Project.
            ProjectsChanaged?.Invoke(this, EventArgs.Empty);
        }
开发者ID:jsschultz,项目名称:PTVS,代码行数:13,代码来源:LoadedProjectInterpreterFactoryProvider.cs


示例13: Trace

        public static void Trace(MBEV.ProjectProperty property, int traceLevel = 0)
        {
            if (property == null || property.IsGlobalProperty || property.IsReservedProperty)
            {
                return;
            }

            PrintPropertyInfo(property, traceLevel);

            if (property.IsImported)
            {
                Trace(property.Predecessor, traceLevel + 1);
            }
        }
开发者ID:nayanshah,项目名称:MSBuildTracer,代码行数:14,代码来源:PropertyTracer.cs


示例14: MSBuildProjectInterpreterFactoryProvider

        /// <summary>
        /// Creates a new provider for the specified project and service.
        /// </summary>
        public MSBuildProjectInterpreterFactoryProvider(IInterpreterOptionsService service, MSBuild.Project project) {
            if (service == null) {
                throw new ArgumentNullException("service");
            }
            if (project == null) {
                throw new ArgumentNullException("project");
            }

            _rootPaths = new Dictionary<Guid, string>();
            _service = service;
            _project = project;

            // _active starts as null, so we need to start with this event
            // hooked up.
            _service.DefaultInterpreterChanged += GlobalDefaultInterpreterChanged;
        }
开发者ID:smallwave,项目名称:PTVS,代码行数:19,代码来源:MSBuildProjectInterpreterFactoryProvider.cs


示例15: CogaenEditProject

        public CogaenEditProject(Package pkg, IOleServiceProvider site, MSBuild.Project buildProject)
        {
            this.package = pkg;
            SetSite(site);
            this.BuildProject = buildProject;
            this.CanFileNodesHaveChilds = true;
            this.OleServiceProvider.AddService(typeof(VSLangProj.VSProject), new OleServiceProvider.ServiceCreatorCallback(this.CreateServices), false);
            this.SupportsProjectDesigner = true;

            //Store the number of images in ProjectNode so we know the offset of the python icons.
            ImageOffset = this.ImageHandler.ImageList.Images.Count;
            foreach (Image img in CogaenEditImageList.Images)
            {
                this.ImageHandler.AddImage(img);
            }

            InitializeCATIDs();
        }
开发者ID:DelBero,项目名称:XnaScrapEdit,代码行数:18,代码来源:CogaenEditProject.cs


示例16: Dependencies

        /// <summary>
        /// Gets a collection of ProjectTargetInstances that this target is dependent on in a given project.
        /// </summary>
        /// <param name="target"></param>
        /// <param name="project">The project to look in</param>
        /// <returns></returns>
        public static IEnumerable<MBEX.ProjectTargetInstance> Dependencies(
            this MBEX.ProjectTargetInstance target, MBEV.Project project)
        {
            var dependencies = new List<MBEX.ProjectTargetInstance>();
            var dependencyTargetNames = project.ResolveAllProperties(target.DependsOnTargets)
                                       .Replace(Environment.NewLine, "")
                                       .Split(';');

            foreach (var name in dependencyTargetNames)
            {
                if (!string.IsNullOrWhiteSpace(name))
                {
                    dependencies.Add(project.Targets[name.Trim()]);
                }
            }

            return dependencies;
        }
开发者ID:nayanshah,项目名称:MSBuildTracer,代码行数:24,代码来源:Extensions.cs


示例17: Generate

        public override void Generate(ProjectType projectType, MSBuild.Project project) {
            var filename = Path.Combine(project.DirectoryPath, Name + projectType.CodeExtension);
            if (!IsMissing) {
                File.WriteAllText(filename, Content ?? projectType.SampleCode);
            }

            if (!IsExcluded) {
                List<KeyValuePair<string, string>> metadata = new List<KeyValuePair<string, string>>();
                if (LinkFile != null) {
                    metadata.Add(new KeyValuePair<string, string>("Link", LinkFile + projectType.CodeExtension));
                }

                project.AddItem(
                    "Compile",
                    Name + projectType.CodeExtension,
                    metadata
                );
            }
        }
开发者ID:ReedCopsey,项目名称:VisualFSharpPowerTools,代码行数:19,代码来源:CompileItem.cs


示例18: PostProcess

        public void PostProcess(MSBuild.Project project) {
            var projectExt = project.Xml.CreateProjectExtensionsElement();
            projectExt.Content = @"
    <VisualStudio>
      <FlavorProperties GUID=""{349c5851-65df-11da-9384-00065b846f21}"">
        <WebProjectProperties>
          <UseIIS>False</UseIIS>
          <AutoAssignPort>True</AutoAssignPort>
          <DevelopmentServerPort>0</DevelopmentServerPort>
          <DevelopmentServerVPath>/</DevelopmentServerVPath>
          <IISUrl>http://localhost:48022/</IISUrl>
          <NTLMAuthentication>False</NTLMAuthentication>
          <UseCustomServer>True</UseCustomServer>
          <CustomServerUrl>http://localhost:1337</CustomServerUrl>
          <SaveServerSettingsInUserFile>False</SaveServerSettingsInUserFile>
        </WebProjectProperties>
      </FlavorProperties>
      <FlavorProperties GUID=""{349c5851-65df-11da-9384-00065b846f21}"" User="""">
        <WebProjectProperties>
          <StartPageUrl>
          </StartPageUrl>
          <StartAction>CurrentPage</StartAction>
          <AspNetDebugging>True</AspNetDebugging>
          <SilverlightDebugging>False</SilverlightDebugging>
          <NativeDebugging>False</NativeDebugging>
          <SQLDebugging>False</SQLDebugging>
          <ExternalProgram>
          </ExternalProgram>
          <StartExternalURL>
          </StartExternalURL>
          <StartCmdLineArguments>
          </StartCmdLineArguments>
          <StartWorkingDirectory>
          </StartWorkingDirectory>
          <EnableENC>False</EnableENC>
          <AlwaysStartWebServerOnDebug>False</AlwaysStartWebServerOnDebug>
        </WebProjectProperties>
      </FlavorProperties>
    </VisualStudio>
";
            project.Xml.AppendChild(projectExt);
        }
开发者ID:paladique,项目名称:nodejstools,代码行数:42,代码来源:NodejsProjectProcessor.cs


示例19: PrintImportInfo

        private void PrintImportInfo(MBEV.ResolvedImport import, int indentLength)
        {
            var indent = indentLength > 0 ? new StringBuilder().Insert(0, " ", indentLength).ToString() : "";

            Utils.WriteColor(indent, ConsoleColor.White);
            Utils.WriteColor($"{import.ImportingElement.Location.Line}: ", ConsoleColor.Cyan);

            var importedProjectFile = project.ResolveAllProperties(import.ImportedProject.Location.File);

            Utils.WriteColor(Path.GetDirectoryName(importedProjectFile) + Path.DirectorySeparatorChar, ConsoleColor.DarkGreen);
            Utils.WriteLineColor(Path.GetFileName(importedProjectFile), ConsoleColor.Green);

            if (!string.IsNullOrWhiteSpace(import.ImportingElement.Condition))
            {
                Utils.WriteColor($"{indent}because ", ConsoleColor.DarkGray);
                Utils.WriteLineColor($"{import.ReducedCondition()}", ConsoleColor.DarkCyan);
            }

            Console.WriteLine();
        }
开发者ID:nayanshah,项目名称:MSBuildTracer,代码行数:20,代码来源:ImportTracer.cs


示例20: Save

        public MSBuild.Project Save(MSBuild.ProjectCollection collection, string location) {
            location = Path.Combine(location, _name);
            Directory.CreateDirectory(location);

            var project = new MSBuild.Project(collection);
            string projectFile = Path.Combine(location, _name) + ProjectType.ProjectExtension;
            if (_isUserProject) {
                projectFile += ".user";
            }
            project.Save(projectFile);

            if (ProjectType != ProjectType.Generic) {
                var projGuid = Guid;
                project.SetProperty("ProjectTypeGuid", TypeGuid.ToString());
                project.SetProperty("Name", _name);
                project.SetProperty("ProjectGuid", projGuid.ToString("B"));
                project.SetProperty("SchemaVersion", "2.0");
                var group = project.Xml.AddPropertyGroup();
                group.Condition = " '$(Configuration)' == 'Debug' ";
                group.AddProperty("DebugSymbols", "true");
                group = project.Xml.AddPropertyGroup();
                group.Condition = " '$(Configuration)' == 'Release' ";
                group.AddProperty("DebugSymbols", "false");
            }

            foreach (var processor in ProjectType.Processors) {
                processor.PreProcess(project);
            }

            foreach (var item in Items) {
                item.Generate(ProjectType, project);
            }

            foreach (var processor in ProjectType.Processors) {
                processor.PostProcess(project);
            }

            project.Save();

            return project;
        }
开发者ID:CforED,项目名称:Node.js-Tools-for-Visual-Studio,代码行数:41,代码来源:ProjectDefinition.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Evaluation.Project类代码示例发布时间:2022-05-24
下一篇:
C# Build.BuildEngine类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap