當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。