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


C# Framework.BuildEventArgs类代码示例

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


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

示例1: AnyEventRaisedHandler

 public void AnyEventRaisedHandler(object sender, BuildEventArgs e)
 {
     if (!(e is BuildStartedEventArgs) && !(e is BuildFinishedEventArgs))
     {
         ErrorUtilities.VerifyThrowInvalidOperation(false, "Should not recieve any events other than build started or finished");
     }
 }
开发者ID:nikson,项目名称:msbuild,代码行数:7,代码来源:NullCentralLogger.cs

示例2: InternalLoggerException

		// FIXME: I made it private temporarily, later we can change it to internal (but not protected)
		private InternalLoggerException (SerializationInfo info, StreamingContext context)
			: base (info, context)
		{
			buildEventArgs = (BuildEventArgs) info.GetValue ("BuildEventArgs", typeof (BuildEventArgs));
			errorCode = info.GetString ("ErrorCode");
			helpKeyword = info.GetString ("HelpKeywordPrefix");
		}
开发者ID:nlhepler,项目名称:mono,代码行数:8,代码来源:InternalLoggerException.cs

示例3: PostLoggingEvent

        /// <summary>
        /// Called to add a logging event to the posting queue.
        /// </summary>
        /// <param name="e"></param>
        internal void PostLoggingEvent(BuildEventArgs e)
        {
            ErrorUtilities.VerifyThrowArgumentNull(e, "e");

            if (paused)
            {
                // Throw out the event
                return;
            }

            if (flushBuildEventsImmediatly)
            {
                ProcessBuildEvent(e);
            }
            else
            {
                // queue the event
                loggingQueueOfBuildEvents.Enqueue(e);

                if (!requestedQueueFlush && loggingQueueOfBuildEvents.WritingQueueCount > flushQueueSize)
                {
                    requestedQueueFlush = true;
                    flushRequestEvent.Set();
                }
            }
        }
开发者ID:nikson,项目名称:msbuild,代码行数:30,代码来源:EngineLoggingServices.cs

示例4: InternalLoggerException

		internal InternalLoggerException (string message, Exception innerException, BuildEventArgs buildEventArgs, string errorCode, string helpKeyword, bool initializationException)
			: base (message, innerException)
		{
			BuildEventArgs = buildEventArgs;
			ErrorCode = errorCode;
			HelpKeyword = helpKeyword;
			InitializationException = initializationException;
		}
开发者ID:KonajuGames,项目名称:SharpLang,代码行数:8,代码来源:InternalLoggerException.cs

示例5: BuildMessage

        private object BuildMessage(BuildEventArgs buildEvent)
        {
            var error = buildEvent as BuildErrorEventArgs;
              if (error == null)
            return string.Format("{0}: {1}", buildEvent.SenderName, buildEvent.Message);

              return string.Format("{0}({1}/{2}): error {3}: {4}", error.File, error.LineNumber, error.ColumnNumber, error.Code, error.Message);
        }
开发者ID:meinsiedler,项目名称:dryrunner,代码行数:8,代码来源:RecordingEventRedirector.cs

示例6: NodeLoggingEventWithLoggerId

 /// <summary>
 /// This method is called by the node loggers to forward the events to cenral logger
 /// </summary>
 void IEventRedirector.ForwardEvent(BuildEventArgs buildEvent)
 {
     // Don't allow forwarding loggers to forward build started
     ErrorUtilities.VerifyThrowInvalidOperation(!(buildEvent is BuildStartedEventArgs), "DontForwardBuildStarted");
     // Don't allow forwarding loggers to forward build finished
     ErrorUtilities.VerifyThrowInvalidOperation(!(buildEvent is BuildFinishedEventArgs), "DontForwardBuildFinished");
     // Mark the event with the logger id metadata and post it to the queue
     NodeLoggingEventWithLoggerId loggingEvent = new NodeLoggingEventWithLoggerId(buildEvent, loggerId);
     loggingService.PostLoggingEvent(loggingEvent);
 }
开发者ID:nikson,项目名称:msbuild,代码行数:13,代码来源:EventRedirector.cs

示例7: GetLogMessage

        protected string GetLogMessage(string eventName, BuildEventArgs e) {
            if (string.IsNullOrEmpty(eventName)) { throw new ArgumentNullException("eventName"); }

            ////e.SenderName is typically set to MSBuild when called through msbuild.exe
            string eMessage = string.Format("{0}\t{1}\t{2}",
                        eventName,
                        FormatString(e.Message),
                        FormatString(e.HelpKeyword)
                        );
            return eMessage;
        }
开发者ID:IIHS,项目名称:side-waffle,代码行数:11,代码来源:InmemoryMsbuildLogger.cs

示例8: WriteLineWithSenderAndMessage

 private void WriteLineWithSenderAndMessage(string line, BuildEventArgs e)
 {
     if (0 == String.Compare(e.SenderName, "MSBuild", true /*ignore case*/))
     {
         // Well, if the sender name is MSBuild, let's leave it out for prettiness
         //WriteLine(line, e);
     }
     else
     {
         //   WriteLine(e.SenderName + ": " + line, e);
     }
 }
开发者ID:MrJoy,项目名称:Alcantarea,代码行数:12,代码来源:BuildLogger.cs

示例9: IsEquivalent

        /// <summary>
        /// Extension method to help our tests without adding shipping code.
        /// Compare this build event context with another object to determine 
        /// equality. This means the values inside the object are identical.
        /// </summary>
        /// <param name="args">The 'this' object</param>
        /// <param name="other">Object to compare to this object</param>
        /// <returns>True if the object values are identical, false if they are not identical</returns>
        public static bool IsEquivalent(this BuildEventArgs args, BuildEventArgs other)
        {
            if (Object.ReferenceEquals(args, other))
            {
                return true;
            }

            if (Object.ReferenceEquals(other, null) || Object.ReferenceEquals(args, null))
            {
                return false;
            }

            if (args.GetType() != other.GetType())
            {
                return false;
            }

            if (args.Timestamp.Ticks != other.Timestamp.Ticks)
            {
                return false;
            }

            if (args.BuildEventContext != other.BuildEventContext)
            {
                return false;
            }

            if (!String.Equals(args.HelpKeyword, other.HelpKeyword, StringComparison.OrdinalIgnoreCase))
            {
                return false;
            }

            // Just in case we're matching chk against ret or vice versa, make sure the message still registers as the same
            string fixedArgsMessage = args.Message.Replace("\r\nThis is an unhandled exception from a task -- PLEASE OPEN A BUG AGAINST THE TASK OWNER.", String.Empty);
            string fixedOtherMessage = other.Message.Replace("\r\nThis is an unhandled exception from a task -- PLEASE OPEN A BUG AGAINST THE TASK OWNER.", String.Empty);

            if (!String.Equals(fixedArgsMessage, fixedOtherMessage, StringComparison.OrdinalIgnoreCase))
            {
                return false;
            }

            if (!String.Equals(args.SenderName, other.SenderName, StringComparison.OrdinalIgnoreCase))
            {
                return false;
            }

            if (args.ThreadId != other.ThreadId)
            {
                return false;
            }

            return true;
        }
开发者ID:JamesLinus,项目名称:msbuild,代码行数:61,代码来源:BuildEventArgsExtension.cs

示例10: RaiseEvent

		public void RaiseEvent(BuildEventArgs e)
		{
			if (e is BuildStatusEventArgs) {
				if (e is TaskStartedEventArgs) {
					if (TaskStarted != null)
						TaskStarted(this, (TaskStartedEventArgs)e);
				} else if (e is TaskFinishedEventArgs) {
					if (TaskFinished != null)
						TaskFinished(this, (TaskFinishedEventArgs)e);
				} else if (e is TargetStartedEventArgs) {
					if (TargetStarted != null)
						TargetStarted(this, (TargetStartedEventArgs)e);
				} else if (e is TargetFinishedEventArgs) {
					if (TargetFinished != null)
						TargetFinished(this, (TargetFinishedEventArgs)e);
				} else if (e is ProjectStartedEventArgs) {
					if (ProjectStarted != null)
						ProjectStarted(this, (ProjectStartedEventArgs)e);
				} else if (e is ProjectFinishedEventArgs) {
					if (ProjectFinished != null)
						ProjectFinished(this, (ProjectFinishedEventArgs)e);
				} else if (e is BuildStartedEventArgs) {
					if (BuildStarted != null)
						BuildStarted(this, (BuildStartedEventArgs)e);
				} else if (e is BuildFinishedEventArgs) {
					if (BuildFinished != null)
						BuildFinished(this, (BuildFinishedEventArgs)e);
				}
				if (StatusEventRaised != null)
					StatusEventRaised(this, (BuildStatusEventArgs)e);
			} else if (e is BuildMessageEventArgs) {
				if (MessageRaised != null)
					MessageRaised(this, (BuildMessageEventArgs)e);
			} else if (e is BuildWarningEventArgs) {
				if (WarningRaised != null)
					WarningRaised(this, (BuildWarningEventArgs)e);
			} else if (e is BuildErrorEventArgs) {
				if (ErrorRaised != null)
					ErrorRaised(this, (BuildErrorEventArgs)e);
			} else if (e is CustomBuildEventArgs) {
				if (CustomEventRaised != null)
					CustomEventRaised(this, (CustomBuildEventArgs)e);
			}
			
			if (AnyEventRaised != null)
				AnyEventRaised(this, e);
		}
开发者ID:kingjiang,项目名称:SharpDevelopLite,代码行数:47,代码来源:EventSource.cs

示例11: base

        /// <summary>
        /// Creates an instance of this exception using rich error information.
        /// Internal for unit testing
        /// </summary>
        /// <remarks>This is the only usable constructor.</remarks>
        /// <param name="message"></param>
        /// <param name="innerException"></param>
        /// <param name="e">Can be null.</param>
        /// <param name="errorCode"></param>
        /// <param name="helpKeyword"></param>
        internal InternalLoggerException
        (
            string message,
            Exception innerException,
            BuildEventArgs e,
            string errorCode,
            string helpKeyword,
            bool initializationException
         )
            : base(message, innerException)
        {
            ErrorUtilities.VerifyThrow((message != null) && (message.Length > 0), "Need error message.");
            ErrorUtilities.VerifyThrow(innerException != null || initializationException == true, "Need the logger exception.");
            ErrorUtilities.VerifyThrow((errorCode != null) && (errorCode.Length > 0), "Must specify the error message code.");
            ErrorUtilities.VerifyThrow((helpKeyword != null) && (helpKeyword.Length > 0), "Must specify the help keyword for the IDE.");

            this.e = e;
            this.errorCode = errorCode;
            this.helpKeyword = helpKeyword;
            this.initializationException = initializationException;
        }
开发者ID:cameron314,项目名称:msbuild,代码行数:31,代码来源:InternalLoggerException.cs

示例12: ErrorItem

        public ErrorItem(int? errorNumber, ErrorLevel errorLevel, BuildEventArgs args)
        {
            _number = errorNumber;
            _level = errorLevel;
            switch (errorLevel)
            {
                case ErrorLevel.Message:
                    Init((BuildMessageEventArgs)args);
                    break;

                case ErrorLevel.Warning:
                    Init((BuildWarningEventArgs)args);
                    break;

                case ErrorLevel.Error:
                    Init((BuildErrorEventArgs)args);
                    break;

                default:
                    throw new ArgumentOutOfRangeException("errorLevel");
            }

            VerifyValues();
        }
开发者ID:ashwinsathyar,项目名称:BuildVision,代码行数:24,代码来源:ErrorItem.cs

示例13: TestTranslation

        public void TestTranslation()
        {
            TaskItem item = new TaskItem("Hello", "my.proj");
            List<TaskItem> targetOutputs = new List<TaskItem>();
            targetOutputs.Add(item);

            Environment.SetEnvironmentVariable("MSBUILDTARGETOUTPUTLOGGING", "1");
            BuildEventArgs[] testArgs = new BuildEventArgs[]
            {
                new BuildFinishedEventArgs("Message", "Keyword", true),
                new BuildStartedEventArgs("Message", "Help"),
                new BuildMessageEventArgs("Message", "help", "sender", MessageImportance.Low),
                new TaskStartedEventArgs("message", "help", "projectFile", "taskFile", "taskName"),
                new TaskFinishedEventArgs("message", "help", "projectFile", "taskFile", "taskName", true),
                new TaskCommandLineEventArgs("commandLine", "taskName", MessageImportance.Low),
                new BuildWarningEventArgs("SubCategoryForSchemaValidationErrors", "MSB4000", "file", 1, 2, 3, 4, "message", "help", "sender"),
                new BuildErrorEventArgs("SubCategoryForSchemaValidationErrors", "MSB4000", "file", 1, 2, 3, 4, "message", "help", "sender"),
                new TargetStartedEventArgs("message", "help", "targetName", "ProjectFile", "targetFile"),
                new TargetFinishedEventArgs("message", "help", "targetName", "ProjectFile", "targetFile", true, targetOutputs),
                new ProjectStartedEventArgs(-1, "message", "help", "ProjectFile", "targetNames", null, null, null),
                new ProjectFinishedEventArgs("message", "help", "ProjectFile", true),
                new ExternalProjectStartedEventArgs("message", "help", "senderName", "projectFile", "targetNames")
            };

            foreach (BuildEventArgs arg in testArgs)
            {
                LogMessagePacket packet = new LogMessagePacket(new KeyValuePair<int, BuildEventArgs>(0, arg));

                ((INodePacketTranslatable)packet).Translate(TranslationHelpers.GetWriteTranslator());
                INodePacket tempPacket = LogMessagePacket.FactoryForDeserialization(TranslationHelpers.GetReadTranslator()) as LogMessagePacket;

                LogMessagePacket deserializedPacket = tempPacket as LogMessagePacket;

                CompareLogMessagePackets(packet, deserializedPacket);
            }

            Environment.SetEnvironmentVariable("MSBUILDTARGETOUTPUTLOGGING", null);
        }
开发者ID:cameron314,项目名称:msbuild,代码行数:38,代码来源:NodePackets_Tests.cs

示例14: VerifyLoggingPacket

 /// <summary>
 /// Verify the LoggingMessagePacket is properly created from a build event. 
 /// This includes the packet type and the event type depending on which build event arg is passed in.
 /// </summary>
 /// <param name="buildEvent">Build event to put into a packet, and verify after packet creation</param>
 /// <param name="logEventType">What is the expected logging event type</param>
 private static void VerifyLoggingPacket(BuildEventArgs buildEvent, LoggingEventType logEventType)
 {
     LogMessagePacket packet = new LogMessagePacket(new KeyValuePair<int, BuildEventArgs>(0, buildEvent));
     Assert.Equal(logEventType, packet.EventType);
     Assert.Equal(NodePacketType.LogMessage, packet.Type);
     Assert.True(Object.ReferenceEquals(buildEvent, packet.NodeBuildEvent.Value.Value)); // "Expected buildEvent to have the same object reference as packet.BuildEvent"
 }
开发者ID:cameron314,项目名称:msbuild,代码行数:13,代码来源:NodePackets_Tests.cs

示例15: SendBuildEvent

        /// <summary>
        /// Sends the requested packet across to the main node. 
        /// </summary>
        private void SendBuildEvent(BuildEventArgs e)
        {
            if (_nodeEndpoint != null && _nodeEndpoint.LinkStatus == LinkStatus.Active)
            {
                if (!e.GetType().IsSerializable)
                {
                    // log a warning and bail.  This will end up re-calling SendBuildEvent, but we know for a fact
                    // that the warning that we constructed is serializable, so everything should be good.  
                    LogWarningFromResource("ExpectedEventToBeSerializable", e.GetType().Name);
                    return;
                }

                _nodeEndpoint.SendData(new LogMessagePacket(new KeyValuePair<int, BuildEventArgs>(_currentConfiguration.NodeId, e)));
            }
        }
开发者ID:JamesLinus,项目名称:msbuild,代码行数:18,代码来源:OutOfProcTaskHostNode.cs


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