本文整理汇总了C#中Microsoft.Build.Framework.BuildEventArgs类的典型用法代码示例。如果您正苦于以下问题:C# BuildEventArgs类的具体用法?C# BuildEventArgs怎么用?C# BuildEventArgs使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
BuildEventArgs类属于Microsoft.Build.Framework命名空间,在下文中一共展示了BuildEventArgs类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: ForwardEvent
/// <summary>
/// When a forwarding logger forwards an event we need to check to see
/// if the event the logger sent us is the same one we sent in.
/// </summary>
/// <param name="buildEvent">Build event to forward</param>
public void ForwardEvent(BuildEventArgs buildEvent)
{
Assert.IsTrue(_expectedEvent == buildEvent, "Expected the forwarded event to match the expected event");
}
开发者ID:JamesLinus,项目名称:msbuild,代码行数:9,代码来源:CentralForwardingLogger_Tests.cs
示例17: TestEventRedirector
/// <summary>
/// Take in an expected event and when the event is forwarded make sure
/// the events are the same.
/// </summary>
/// <param name="eventToExpect">Event we expect to see in the ForwardEvent method</param>
public TestEventRedirector(BuildEventArgs eventToExpect)
{
_expectedEvent = eventToExpect;
}
开发者ID:JamesLinus,项目名称:msbuild,代码行数:9,代码来源:CentralForwardingLogger_Tests.cs
示例18: AttachForwardingLoggerAndRedirector
/// <summary>
/// Create a new forwarding logger, event redirector, and event source.
/// The returned event source can then have and event raised on it and it can
/// check to see if the event raised matches the one we were expecting.
/// </summary>
/// <param name="buildEventToCheck">A build event we are expecting to be forwarded by the forwarding logger</param>
/// <returns>An event source on which one can raise an event.</returns>
private static EventSourceSink AttachForwardingLoggerAndRedirector(BuildEventArgs buildEventToCheck)
{
EventSourceSink loggerEventSource = new EventSourceSink();
CentralForwardingLogger forwardingLogger = new CentralForwardingLogger();
TestEventRedirector eventRedirector = new TestEventRedirector(buildEventToCheck);
forwardingLogger.BuildEventRedirector = eventRedirector;
forwardingLogger.Initialize(loggerEventSource);
return loggerEventSource;
}
开发者ID:JamesLinus,项目名称:msbuild,代码行数:16,代码来源:CentralForwardingLogger_Tests.cs
示例19: LoggerEventHandler
/*
* Method: LoggerEventHandler
* Owner: jomof
*
* Recieves build events and logs them the way we like.
*
*/
internal void LoggerEventHandler(object sender, BuildEventArgs eventArgs)
{
if (eventArgs is BuildWarningEventArgs)
{
BuildWarningEventArgs w = (BuildWarningEventArgs) eventArgs;
// hack: disregard the MTA warning.
// need the second condition to pass on ploc builds
if (w.Code != "MSB4056" && !w.Message.Contains("MSB4056"))
{
fullLog.AppendFormat("{0}({1},{2}): {3} warning {4}: {5}\r\n",
w.File,
w.LineNumber,
w.ColumnNumber,
w.Subcategory,
w.Code,
w.Message);
++warningCount;
this.warnings.Add(w);
}
}
else if (eventArgs is BuildErrorEventArgs)
{
BuildErrorEventArgs e = (BuildErrorEventArgs) eventArgs;
fullLog.AppendFormat("{0}({1},{2}): {3} error {4}: {5}\r\n",
e.File,
e.LineNumber,
e.ColumnNumber,
e.Subcategory,
e.Code,
e.Message);
++errorCount;
this.errors.Add(e);
}
else
{
fullLog.Append(eventArgs.Message);
fullLog.Append("\r\n");
}
if (eventArgs is ExternalProjectStartedEventArgs)
{
this.ExternalProjectStartedEvents.Add((ExternalProjectStartedEventArgs)eventArgs);
}
else if (eventArgs is ExternalProjectFinishedEventArgs)
{
this.ExternalProjectFinishedEvents.Add((ExternalProjectFinishedEventArgs)eventArgs);
}
if (eventArgs is BuildFinishedEventArgs)
{
// Console.Write in the context of a unit test is very expensive. A hundred
// calls to Console.Write can easily take two seconds on a fast machine. Therefore, only
// do the Console.Write once at the end of the build.
Console.Write(FullLog);
}
}
开发者ID:nikson,项目名称:msbuild,代码行数:67,代码来源:MockLogger.cs
示例20: LogEvent
/// <summary>
/// This is the method that does the main work of logging an event
/// when one is sent to this logger.
/// </summary>
private void LogEvent(object sender, BuildEventArgs buildEvent)
{
// Fill in the Message text
if (OutputWindowPane != null && !String.IsNullOrEmpty(buildEvent.Message))
{
StringBuilder msg = new StringBuilder(this.currentIndent + buildEvent.Message.Length + 1);
if (this.currentIndent > 0)
{
msg.Append('\t', this.currentIndent);
}
msg.AppendLine(buildEvent.Message);
this.OutputWindowPane.OutputStringThreadSafe(msg.ToString());
}
}
开发者ID:Jeremiahf,项目名称:wix3,代码行数:18,代码来源:idebuildlogger.cs
注:本文中的Microsoft.Build.Framework.BuildEventArgs类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论