本文整理汇总了C#中Microsoft.Build.Framework.TargetFinishedEventArgs类的典型用法代码示例。如果您正苦于以下问题:C# TargetFinishedEventArgs类的具体用法?C# TargetFinishedEventArgs怎么用?C# TargetFinishedEventArgs使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
TargetFinishedEventArgs类属于Microsoft.Build.Framework命名空间,在下文中一共展示了TargetFinishedEventArgs类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: VerifyEventType
public void VerifyEventType()
{
BuildFinishedEventArgs buildFinished = new BuildFinishedEventArgs("Message", "Keyword", true);
BuildStartedEventArgs buildStarted = new BuildStartedEventArgs("Message", "Help");
BuildMessageEventArgs lowMessage = new BuildMessageEventArgs("Message", "help", "sender", MessageImportance.Low);
TaskStartedEventArgs taskStarted = new TaskStartedEventArgs("message", "help", "projectFile", "taskFile", "taskName");
TaskFinishedEventArgs taskFinished = new TaskFinishedEventArgs("message", "help", "projectFile", "taskFile", "taskName", true);
TaskCommandLineEventArgs commandLine = new TaskCommandLineEventArgs("commandLine", "taskName", MessageImportance.Low);
BuildWarningEventArgs warning = new BuildWarningEventArgs("SubCategoryForSchemaValidationErrors", "MSB4000", "file", 1, 2, 3, 4, "message", "help", "sender");
BuildErrorEventArgs error = new BuildErrorEventArgs("SubCategoryForSchemaValidationErrors", "MSB4000", "file", 1, 2, 3, 4, "message", "help", "sender");
TargetStartedEventArgs targetStarted = new TargetStartedEventArgs("message", "help", "targetName", "ProjectFile", "targetFile");
TargetFinishedEventArgs targetFinished = new TargetFinishedEventArgs("message", "help", "targetName", "ProjectFile", "targetFile", true);
ProjectStartedEventArgs projectStarted = new ProjectStartedEventArgs(-1, "message", "help", "ProjectFile", "targetNames", null, null, null);
ProjectFinishedEventArgs projectFinished = new ProjectFinishedEventArgs("message", "help", "ProjectFile", true);
ExternalProjectStartedEventArgs externalStartedEvent = new ExternalProjectStartedEventArgs("message", "help", "senderName", "projectFile", "targetNames");
VerifyLoggingPacket(buildFinished, LoggingEventType.BuildFinishedEvent);
VerifyLoggingPacket(buildStarted, LoggingEventType.BuildStartedEvent);
VerifyLoggingPacket(lowMessage, LoggingEventType.BuildMessageEvent);
VerifyLoggingPacket(taskStarted, LoggingEventType.TaskStartedEvent);
VerifyLoggingPacket(taskFinished, LoggingEventType.TaskFinishedEvent);
VerifyLoggingPacket(commandLine, LoggingEventType.TaskCommandLineEvent);
VerifyLoggingPacket(warning, LoggingEventType.BuildWarningEvent);
VerifyLoggingPacket(error, LoggingEventType.BuildErrorEvent);
VerifyLoggingPacket(targetStarted, LoggingEventType.TargetStartedEvent);
VerifyLoggingPacket(targetFinished, LoggingEventType.TargetFinishedEvent);
VerifyLoggingPacket(projectStarted, LoggingEventType.ProjectStartedEvent);
VerifyLoggingPacket(projectFinished, LoggingEventType.ProjectFinishedEvent);
VerifyLoggingPacket(externalStartedEvent, LoggingEventType.CustomEvent);
}
示例2: EventArgsCtors
public void EventArgsCtors()
{
List<ITaskItem> outputs = new List<ITaskItem>();
TargetFinishedEventArgs targetFinishedEvent = new TargetFinishedEventArgs2();
targetFinishedEvent = new TargetFinishedEventArgs("Message", "HelpKeyword", "TargetName", "ProjectFile", "TargetFile", true);
targetFinishedEvent = new TargetFinishedEventArgs("Message", "HelpKeyword", "TargetName", "ProjectFile", "TargetFile", true, DateTime.Now, outputs);
targetFinishedEvent = new TargetFinishedEventArgs(null, null, null, null, null, true);
targetFinishedEvent = new TargetFinishedEventArgs(null, null, null, null, null, true, DateTime.Now, null);
}
示例3: TestSendsAbsoluteFileThreadSafeUsesStack
public void TestSendsAbsoluteFileThreadSafeUsesStack()
{
TargetStartedEventArgs s1 = MakeTargetStartedEventArgs("/home/samantha/work/module1/module1.csproj");
TargetStartedEventArgs s2 = MakeTargetStartedEventArgs("/home/samantha/work/module2/module2.csproj");
logger.TargetStarted(this, s1);
logger.TargetStarted(this, s2);
TargetFinishedEventArgs f1 = new TargetFinishedEventArgs("", "", "", s2.ProjectFile, s2.ProjectFile, true);
f1.BuildEventContext = s1.BuildEventContext;
logger.TargetFinished(this, f1);
logger.BuildErrorRaised(this, MakeBuildErrorEventArgs());
Assert.That(files.Count, Is.EqualTo(1));
Assert.That(Path.IsPathRooted(files[0]), Is.True);
Assert.That(files[0], Text.Contains("module1"));
}
示例4: AssignmentTest
public void AssignmentTest ()
{
TargetFinishedEventArgs tfea;
string message = "message";
string helpKeyword = "helpKeyword";
string targetName = "targetName";
string projectFile = "projectFile";
string targetFile = "targetFile";
bool succeeded = true;
tfea = new TargetFinishedEventArgs (message, helpKeyword, targetName, projectFile, targetFile, succeeded);
Assert.AreEqual (message, tfea.Message, "Message");
Assert.AreEqual (helpKeyword, tfea.HelpKeyword, "HelpKeyword");
Assert.AreEqual (targetName, tfea.TargetName, "TargetName");
Assert.AreEqual (projectFile, tfea.ProjectFile, "ProjectFile");
Assert.AreEqual (targetFile, tfea.TargetFile, "TargetFile");
Assert.AreEqual (succeeded, tfea.Succeeded, "Succeeded");
}
示例5: TranslateTargetFinishedEvent
/// <summary>
/// Translate the TargetOutputs for the target finished event.
/// </summary>
private static void TranslateTargetFinishedEvent(INodePacketTranslator translator, TargetFinishedEventArgs finishedEvent)
{
List<TaskItem> targetOutputs = null;
if (translator.Mode == TranslationDirection.WriteToStream)
{
if (finishedEvent.TargetOutputs != null)
{
targetOutputs = new List<TaskItem>();
foreach (TaskItem item in finishedEvent.TargetOutputs)
{
targetOutputs.Add(item);
}
}
}
translator.Translate<TaskItem>(ref targetOutputs, TaskItem.FactoryForDeserialization);
if (translator.Mode == TranslationDirection.ReadFromStream)
{
finishedEvent.TargetOutputs = targetOutputs;
}
}
示例6: BuildMessage
public BuildMessage(TargetFinishedEventArgs args)
{
EventType = args.GetType().Name.Replace("EventArgs", "");
Message = args.Message;
ProjectFile = args.ProjectFile;
Succeeded = args.Succeeded;
TargetFile = args.TargetFile;
TargetName = args.TargetName;
HelpKeyword = args.HelpKeyword;
SenderName = args.SenderName;
Timestamp = args.Timestamp;
ThreadId = args.ThreadId;
}
示例7: TargetFinished
void TargetFinished(object sender, TargetFinishedEventArgs e)
{
}
示例8: LogTargetFinished
void LogTargetFinished (Target target, bool succeeded)
{
TargetFinishedEventArgs tfea;
string projectFile = project.FullFileName;
tfea = new TargetFinishedEventArgs (String.Format ("Target {0} finished.", target.Name), null,
target.Name, projectFile, target.TargetFile, succeeded);
target.Engine.EventSource.FireTargetFinished (this, tfea);
}
示例9: TargetFinishedHandler
/// <summary>
/// This is the delegate for TargetFinishedHandler events.
/// </summary>
private void TargetFinishedHandler(object sender, TargetFinishedEventArgs buildEvent)
{
--this.currentIndent;
if ((isLogTaskDone) &&
LogAtImportance(buildEvent.Succeeded ? MessageImportance.Low
: MessageImportance.High))
{
LogEvent(sender, buildEvent);
}
}
示例10: TargetFinished
void TargetFinished(object sender, TargetFinishedEventArgs e)
{
XmlElement targetElement = targetElements.Pop();
targetElements.Push(targetElement);
targetElement.Attributes.Append(CreateFinishedAttribute(e.Timestamp));
targetElement.Attributes.Append(CreateAttribute("Succeeded", e.Succeeded.ToString()));
if (base.IsVerbosityAtLeast(LoggerVerbosity.Detailed))
{
targetElement.Attributes.Append(CreateAttribute("FinishMessage", e.Message));
}
buildTypeList.Pop();
}
示例11: TargetFinished
private void TargetFinished(object sender, TargetFinishedEventArgs e)
{
this.LogFinished();
}
示例12: TestLoggingEventCustomerSerialization
public void TestLoggingEventCustomerSerialization()
{
Hashtable loggingTypeCacheWrites = new Hashtable();
stream.Position = 0;
BuildEventContext context = new BuildEventContext(1,3,5,7);
GenericBuildEventArg genericBuildEvent = new GenericBuildEventArg("Message","Help","Sender");
genericBuildEvent.BuildEventContext = context;
NodeLoggingEvent genericBuildEventLoggingEvent = new NodeLoggingEvent(genericBuildEvent);
genericBuildEventLoggingEvent.WriteToStream(writer, loggingTypeCacheWrites);
GenericCustomBuildEventArg genericCustomEvent = new GenericCustomBuildEventArg("FooFighter");
genericCustomEvent.BuildEventContext = context;
NodeLoggingEvent genericCustomEventLoggingEvent = new NodeLoggingEvent(genericCustomEvent);
genericCustomEventLoggingEvent.WriteToStream(writer, loggingTypeCacheWrites);
BuildErrorEventArgs errorEvent = new BuildErrorEventArgs("Subcategory", "Code", "File", 1, 2, 3, 4, "Message", "HelpKeyword", "SenderName");
errorEvent.BuildEventContext = context;
NodeLoggingEvent errorEventLoggingEvent = new NodeLoggingEvent(errorEvent);
errorEventLoggingEvent.WriteToStream(writer, loggingTypeCacheWrites);
BuildMessageEventArgs messageEvent = new BuildMessageEventArgs("Message", "HelpKeyword", "SenderName",MessageImportance.High);
messageEvent.BuildEventContext = context;
NodeLoggingEvent messageEventLoggingEvent = new NodeLoggingEvent(messageEvent);
messageEventLoggingEvent.WriteToStream(writer, loggingTypeCacheWrites);
BuildWarningEventArgs warningEvent = new BuildWarningEventArgs("Subcategory", "Code", "File", 1, 2, 3, 4, "Message", "HelpKeyword", "SenderName");
warningEvent.BuildEventContext = context;
NodeLoggingEvent warningEventLoggingEvent = new NodeLoggingEvent(warningEvent);
warningEventLoggingEvent.WriteToStream(writer, loggingTypeCacheWrites);
ProjectStartedEventArgs projectStartedEvent = new ProjectStartedEventArgs( 8,"Message", "HelpKeyword", "ProjectFile", "TargetNames", null, null, new BuildEventContext(7,8,9,10));
projectStartedEvent.BuildEventContext = context;
NodeLoggingEvent projectStartedEventLoggingEvent = new NodeLoggingEvent(projectStartedEvent);
projectStartedEventLoggingEvent.WriteToStream(writer, loggingTypeCacheWrites);
ProjectFinishedEventArgs projectFinishedEvent = new ProjectFinishedEventArgs("Message", "HelpKeyword","ProjectFile",true);
projectFinishedEvent.BuildEventContext = context;
NodeLoggingEvent projectFinishedEventLoggingEvent = new NodeLoggingEvent(projectFinishedEvent);
projectFinishedEventLoggingEvent.WriteToStream(writer, loggingTypeCacheWrites);
TargetStartedEventArgs targetStartedEvent = new TargetStartedEventArgs("Message", "HelpKeyword", "TargetName", "ProjectFile", "TargetFile");
targetStartedEvent.BuildEventContext = context;
NodeLoggingEvent targetStartedEventLoggingEvent = new NodeLoggingEvent(targetStartedEvent);
targetStartedEventLoggingEvent.WriteToStream(writer, loggingTypeCacheWrites);
TargetFinishedEventArgs targetFinished = new TargetFinishedEventArgs("Message", "HelpKeyword","TargetName", "ProjectFile", "TargetFile", true);
targetFinished.BuildEventContext = context;
NodeLoggingEvent targetFinishedEventLoggingEvent = new NodeLoggingEvent(targetFinished);
targetFinishedEventLoggingEvent.WriteToStream(writer, loggingTypeCacheWrites);
TaskStartedEventArgs taskStartedEvent = new TaskStartedEventArgs("Message", "HelpKeyword", "ProjectFile", "TaskFile", "TaskName");
taskStartedEvent.BuildEventContext = context;
NodeLoggingEvent taskStartedEventLoggingEvent = new NodeLoggingEvent(taskStartedEvent);
taskStartedEventLoggingEvent.WriteToStream(writer, loggingTypeCacheWrites);
TaskFinishedEventArgs taskFinishedEvent = new TaskFinishedEventArgs("Message", "HelpKeyword", "ProjectFile", "TaskFile", "TaskName", true);
taskFinishedEvent.BuildEventContext = context;
NodeLoggingEvent taskFinishedEventLoggingEvent = new NodeLoggingEvent(taskFinishedEvent);
taskFinishedEventLoggingEvent.WriteToStream(writer, loggingTypeCacheWrites);
BuildFinishedEventArgs buildFinishedEvent = new BuildFinishedEventArgs("Message","Help",true);
buildFinishedEvent.BuildEventContext = context;
NodeLoggingEvent buildFinishedEventEventLoggingEvent = new NodeLoggingEvent(buildFinishedEvent);
buildFinishedEventEventLoggingEvent.WriteToStream(writer, loggingTypeCacheWrites);
BuildStartedEventArgs buildStartedEvent = new BuildStartedEventArgs("Message","Help");
buildStartedEvent.BuildEventContext = context;
NodeLoggingEvent buildStartedEventLoggingEvent = new NodeLoggingEvent(buildStartedEvent);
buildStartedEventLoggingEvent.WriteToStream(writer, loggingTypeCacheWrites);
TaskCommandLineEventArgs commandlineEventArg = new TaskCommandLineEventArgs("CommandLine","TaskName", MessageImportance.High);
commandlineEventArg.BuildEventContext = context;
NodeLoggingEvent commandlineEventArgLoggingEvent = new NodeLoggingEvent(commandlineEventArg);
commandlineEventArgLoggingEvent.WriteToStream(writer, loggingTypeCacheWrites);
Hashtable loggingTypeCacheReads = new Hashtable();
long streamWriteEndPosition = stream.Position;
stream.Position = 0;
NodeLoggingEvent nodeLoggingEvent = new NodeLoggingEvent(null);
nodeLoggingEvent.CreateFromStream(reader, loggingTypeCacheReads);
Assert.IsTrue(nodeLoggingEvent.BuildEvent.GetType() == typeof(GenericBuildEventArg));
nodeLoggingEvent = new NodeLoggingEvent(null);
nodeLoggingEvent.CreateFromStream(reader, loggingTypeCacheReads);
Assert.IsTrue(nodeLoggingEvent.BuildEvent.GetType() == typeof(GenericCustomBuildEventArg));
nodeLoggingEvent = new NodeLoggingEvent(null);
nodeLoggingEvent.CreateFromStream(reader, loggingTypeCacheReads);
Assert.IsTrue(nodeLoggingEvent.BuildEvent.GetType() == typeof(BuildErrorEventArgs));
nodeLoggingEvent = new NodeLoggingEvent(null);
nodeLoggingEvent.CreateFromStream(reader, loggingTypeCacheReads);
Assert.IsTrue(nodeLoggingEvent.BuildEvent.GetType() == typeof(BuildMessageEventArgs));
nodeLoggingEvent = new NodeLoggingEvent(null);
nodeLoggingEvent.CreateFromStream(reader, loggingTypeCacheReads);
Assert.IsTrue(nodeLoggingEvent.BuildEvent.GetType() == typeof(BuildWarningEventArgs));
nodeLoggingEvent = new NodeLoggingEvent(null);
//.........这里部分代码省略.........
示例13: TargetFinishedHandler
/// <summary>
/// Handler for target finished events
/// </summary>
/// <param name="sender">sender (should be null)</param>
/// <param name="e">event arguments</param>
public void TargetFinishedHandler(object sender, TargetFinishedEventArgs e)
{
InitializeBaseConsoleLogger(); // for compat: see DDB#136924
_consoleLogger.TargetFinishedHandler(sender, e);
}
示例14: RaiseTargetFinishedEvent
/// <summary>
/// Raises a "target build finished" event to all registered loggers.
/// </summary>
/// <param name="sender">sender of the event</param>
/// <param name="buildEvent">TargetFinishedEventArgs</param>
/// <exception cref="LoggerException">When EventHandler raises an logger exception the LoggerException is rethrown</exception>
/// <exception cref="InternalLoggerException">Any exceptions which are not LoggerExceptions are wrapped in an InternalLoggerException</exception>
/// <exception cref="Exception">ExceptionHandling.IsCriticalException exceptions will not be wrapped</exception>
private void RaiseTargetFinishedEvent(object sender, TargetFinishedEventArgs buildEvent)
{
if (TargetFinished != null)
{
try
{
TargetFinished(sender, buildEvent);
}
catch (LoggerException)
{
// if a logger has failed politely, abort immediately
// first unregister all loggers, since other loggers may receive remaining events in unexpected orderings
// if a fellow logger is throwing in an event handler.
this.UnregisterAllEventHandlers();
throw;
}
catch (Exception exception)
{
// first unregister all loggers, since other loggers may receive remaining events in unexpected orderings
// if a fellow logger is throwing in an event handler.
this.UnregisterAllEventHandlers();
if (ExceptionHandling.IsCriticalException(exception))
{
throw;
}
InternalLoggerException.Throw(exception, buildEvent, "FatalErrorWhileLogging", false);
}
}
RaiseStatusEvent(sender, buildEvent);
}
示例15: VerifyTargetFinished
/// <summary>
/// Compare two TargetFinished events
/// </summary>
private static void VerifyTargetFinished(TargetFinishedEventArgs genericEvent, TargetFinishedEventArgs newGenericEvent)
{
Assert.IsTrue(genericEvent.Succeeded == newGenericEvent.Succeeded, "Expected Succeeded to Match");
Assert.IsTrue(string.Compare(genericEvent.ProjectFile, newGenericEvent.ProjectFile, StringComparison.OrdinalIgnoreCase) == 0, "Expected ProjectFile to Match");
Assert.IsTrue(string.Compare(genericEvent.TargetFile, newGenericEvent.TargetFile, StringComparison.OrdinalIgnoreCase) == 0, "Expected TargetFile to Match");
Assert.IsTrue(string.Compare(genericEvent.TargetName, newGenericEvent.TargetName, StringComparison.OrdinalIgnoreCase) == 0, "Expected TargetName to Match");
}