/// <summary> /// Constructs a project logging context. /// </summary> internal ProjectLoggingContext(NodeLoggingContext nodeLoggingContext, BuildRequest request, string projectFullPath, string toolsVersion, BuildEventContext parentBuildEventContext) : this ( nodeLoggingContext, request.SubmissionId, request.ConfigurationId, projectFullPath, request.Targets, toolsVersion, null, null, parentBuildEventContext ) { }
/// <summary> /// Constructs a project logging context. /// </summary> internal ProjectLoggingContext(NodeLoggingContext nodeLoggingContext, BuildRequestEntry requestEntry, BuildEventContext parentBuildEventContext) : this ( nodeLoggingContext, requestEntry.Request.SubmissionId, requestEntry.Request.ConfigurationId, requestEntry.RequestConfiguration.ProjectFullPath, requestEntry.Request.Targets, requestEntry.RequestConfiguration.ToolsVersion, requestEntry.RequestConfiguration.Project.PropertiesToBuildWith, requestEntry.RequestConfiguration.Project.ItemsToBuildWith, parentBuildEventContext ) { }
/// <summary> /// Constructs a project logging contexts. /// </summary> private ProjectLoggingContext(NodeLoggingContext nodeLoggingContext, int submissionId, int configurationId, string projectFullPath, List <string> targets, string toolsVersion, PropertyDictionary <ProjectPropertyInstance> projectProperties, ItemDictionary <ProjectItemInstance> projectItems, BuildEventContext parentBuildEventContext) : base(nodeLoggingContext) { _nodeLoggingContext = nodeLoggingContext; _projectFullPath = projectFullPath; ProjectPropertyInstanceEnumeratorProxy properties = null; ProjectItemInstanceEnumeratorProxy items = null; IEnumerable <ProjectPropertyInstance> projectPropertiesEnumerator = projectProperties == null?Array.Empty <ProjectPropertyInstance>() : null; IEnumerable <ProjectItemInstance> projectItemsEnumerator = projectItems == null?Array.Empty <ProjectItemInstance>() : null; string[] propertiesToSerialize = LoggingService.PropertiesToSerialize; // If we are only logging critical events lets not pass back the items or properties if (!LoggingService.OnlyLogCriticalEvents && (!LoggingService.RunningOnRemoteNode || LoggingService.SerializeAllProperties)) { if (projectProperties != null) { projectPropertiesEnumerator = projectProperties.GetCopyOnReadEnumerable(); } if (projectItems != null) { projectItemsEnumerator = projectItems.GetCopyOnReadEnumerable(); } properties = new ProjectPropertyInstanceEnumeratorProxy(projectPropertiesEnumerator); items = new ProjectItemInstanceEnumeratorProxy(projectItemsEnumerator); } if (projectProperties != null && propertiesToSerialize != null && propertiesToSerialize.Length > 0 && !LoggingService.SerializeAllProperties) { PropertyDictionary <ProjectPropertyInstance> projectPropertiesToSerialize = new PropertyDictionary <ProjectPropertyInstance>(); foreach (string propertyToGet in propertiesToSerialize) { ProjectPropertyInstance instance = projectProperties[propertyToGet]; { if (instance != null) { projectPropertiesToSerialize.Set(instance); } } } properties = new ProjectPropertyInstanceEnumeratorProxy(projectPropertiesToSerialize); } this.BuildEventContext = LoggingService.LogProjectStarted ( nodeLoggingContext.BuildEventContext, submissionId, configurationId, parentBuildEventContext, projectFullPath, String.Join(";", targets), properties, items ); LoggingService.LogComment(this.BuildEventContext, MessageImportance.Low, "ToolsVersionInEffectForBuild", toolsVersion); this.IsValid = true; }