共用方式為


IBuildEventArgsReaderNotifications.ArchiveFileEncountered Event

Definition

An event that allows the caller to be notified when an embedded file is encountered in the binary log. When subscriber is OK with greedy reading entire content of the file and is interested only in the individual strings (e.g. for sensitive data redaction purposes), it can simplify subscribing to this event, by using handler with same signature as handler for StringReadDone and wrapping it via ToArchiveFileHandler(Action<StringReadEventArgs>) extension.

public:
 event Action<Microsoft::Build::Logging::ArchiveFileEventArgs ^> ^ ArchiveFileEncountered;
event Action<Microsoft.Build.Logging.ArchiveFileEventArgs>? ArchiveFileEncountered;
member this.ArchiveFileEncountered : Action<Microsoft.Build.Logging.ArchiveFileEventArgs> 
Event ArchiveFileEncountered As Action(Of ArchiveFileEventArgs) 

Event Type

Examples

private void OnStringReadDone(StringReadEventArgs e)
{
    e.StringToBeUsed = e.StringToBeUsed.Replace("foo", "bar");
}

private void SubscribeToEvents()
{
    reader.StringReadDone += OnStringReadDone;
    reader.ArchiveFileEncountered += ((Action<StringReadEventArgs>)OnStringReadDone).ToArchiveFileHandler();
}

Applies to