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


C# Build.Evaluation类代码示例

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


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


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